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 ( #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
Node Status?
node history
Node Type: note [id://521817]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2016-06-25 01:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (322 votes). Check out past polls.