Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > how to warn?

Reply
Thread Tools

how to warn?

 
 
Jason L. Woodruff
Guest
Posts: n/a
 
      09-09-2004
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

 
Reply With Quote
 
 
 
 
Andres Monroy-Hernandez
Guest
Posts: n/a
 
      09-10-2004
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" <(E-Mail Removed)> wrote in message news:<rkU%c.109$(E-Mail Removed)>...
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments