Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: DBI error and $@

by Arguile (Hermit)
on Dec 06, 2001 at 21:32 UTC ( #130006=note: print w/ replies, xml ) Need Help??


in reply to DBI error and $@

Personally when I'm doing transaction handling I use Error or other exception handling modules. The addition of a little syntatic sugar make a lot of difference. You can also define your own error classes for more complex failovers.

use Error qw(:try); # ... code passes ... try { # Execute a few queries $sth->execute( $str ); # If we're here everything is fine, let's commit. $dbh->commit; } catch Error with { my $err = shift; print "Transaction Failed: $err"; $dbh->rollback; };


Comment on Re: DBI error and $@
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (17)
As of 2015-07-28 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (255 votes), past polls