Jeff Pan wrote: > hi, > > Because of network problem,my script can't create Mysql dbh sometime > when running,then it died.I have written code like this: > > my > $mysql_dbh=DBI->connect("dbi:mysql:$mysql_db:$mysql_host",$mysql_user,$mysql_passwd, > {PrintError => 1,RaiseError => 0}); > > I want to know how to adjust it,thanks a lot. >
According to the DBI docs "connect" should be returning undef on failure and should not be causing the script to die. Can you show us some code? In most cases you would catch an exception (death) caused by a module using "eval" to wrap the code in a block. perldoc -f eval eval { # code that could fail die "...."; } if ($@) { # handle error condition here, error is in $@ } HTH, http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>