Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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


Comment on Re: Not getting the expected result when using eval/alarm
Download Code

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 romping around the Monastery: (9)
As of 2014-12-27 17:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls