Re: [exim] Need a little perl advice

Top Page
Delete this message
Reply to this message
Author: Drav Sloan
Date:  
To: Marc Perkel
CC: exim-users, rirans
Subject: Re: [exim] Need a little perl advice
Marc Perkel wrote:
> I figured it out. This seems to work best:
>
> sub &mysql {
>    $st = join('',@_);


You may want to protect that assignment for cases when @_ is not set, also it's
best to declare variables with 'my':

my($st) = join('', ($#@_ != -1 ? @_ : () ) );

>    my $query = $dbh->prepare($st);


Also you are not verifying if your $dbh is defined before making a call on it,
and also you are not checking to see if the prepare was accepted and the execute
return value. Read 'perdoc DBI' for a more in depth look at checkin each step of
a DBI call (the create of dbh, the setting of the $sth, the actual proccessing
of the execute).

Lazy code often will bite you later.

Regards

D.