how to warn?

Discussion in 'Perl' started by Jason L. Woodruff, Sep 9, 2004.

  1. Hell guys:

    I'm going to say it....I'm a newbie to PERL (sorta) and I'm working
    around with a script that opens a database (user.db) and
    adds/removes/and updates data in the database. The script will delete a
    entry in the the database file but i would like to warn the user before
    the actual delete is done.

    Here is some code I'm looking at:

    if ($input{'action'} eq 'delete'){
    open (DATABASE,">$database");
    @DB=<DATABASE>;
    foreach $rec (@ODB){
    chomp..................so on...............

    I was wondering, if I slip the "{else}" "statement" in between this:


    if ($input{'action'} eq 'delete'){
    *the warning - user interaction - $Yes = proceed or $No = cancel *
    {else}
    *$Yes = go ahead and delete*



    I would like to use some kind of "event handler", but If anyone has any
    suggestions or experience, I would appreciate your help.

    TIA
    -JLW


    --
    Registered Linux user #339721
    Visit me @ http://jlwoodruff.mystarband.net
     
    Jason L. Woodruff, Sep 9, 2004
    #1
    1. Advertising

  2. Jason,

    First, if you're going to use a DB based on files, I would recommend
    you to use something like Berkeley DB.

    Secondly, for the warning messages a simple print and STDIN would do
    i,


    Best regards,

    -Andres Monroy-Hernandez



    "Jason L. Woodruff" <> wrote in message news:<rkU%c.109$>...
    > Hell guys:
    >
    > I'm going to say it....I'm a newbie to PERL (sorta) and I'm working
    > around with a script that opens a database (user.db) and
    > adds/removes/and updates data in the database. The script will delete a
    > entry in the the database file but i would like to warn the user before
    > the actual delete is done.
    >
    > Here is some code I'm looking at:
    >
    > if ($input{'action'} eq 'delete'){
    > open (DATABASE,">$database");
    > @DB=<DATABASE>;
    > foreach $rec (@ODB){
    > chomp..................so on...............
    >
    > I was wondering, if I slip the "{else}" "statement" in between this:
    >
    >
    > if ($input{'action'} eq 'delete'){
    > *the warning - user interaction - $Yes = proceed or $No = cancel *
    > {else}
    > *$Yes = go ahead and delete*
    >
    >
    >
    > I would like to use some kind of "event handler", but If anyone has any
    > suggestions or experience, I would appreciate your help.
    >
    > TIA
    > -JLW
     
    Andres Monroy-Hernandez, Sep 10, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Elmo Watson

    Trace.Warn

    Elmo Watson, Oct 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    579
    Elmo Watson
    Oct 29, 2003
  2. Tone Curtis
    Replies:
    3
    Views:
    4,536
    Tone Curtis
    Jun 10, 2004
  3. Replies:
    7
    Views:
    25,959
    rohit.net100
    Feb 28, 2011
  4. =?Utf-8?B?Tkg=?=

    Warn user that session expired?

    =?Utf-8?B?Tkg=?=, Jan 6, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    4,196
    Peter Rilling
    Jan 6, 2006
  5. Gerben
    Replies:
    3
    Views:
    776
    Alexey Dmitriev
    Oct 11, 2003
Loading...

Share This Page