Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Not getting the expected result when using eval/alarm

by JamesNC (Chaplain)
on Jan 08, 2006 at 14:33 UTC ( [id://521817]=note: print w/replies, xml ) Need Help??


in reply to Not getting the expected result when using eval/alarm

try doing your dbi connect stuff like this:
eval { $db = DBI->connect("dbi:mysql:database="$remotedb"; host=127.0.0.1;p +ort=$port", "$user", "$pass", { RaiseError=>1, PrintError=>0 } ); }; if ($@){ #handle db error (ie, host not available.. blah blah }else{ return $db; }

Notice I added {RaiseError=>1, PrintError=>0} to your dbi call and then eval the call to DBI.

JamesNC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://521817]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 17:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found