Skip to content

Instantly share code, notes, and snippets.

@alexdioso
Created September 18, 2011 19:54
Show Gist options
  • Save alexdioso/1225484 to your computer and use it in GitHub Desktop.
Save alexdioso/1225484 to your computer and use it in GitHub Desktop.
Perl disable DBI HandleError
my $previous_handler = $dbh->{'HandleError'};
$dbh->{'HandleError'} = undef;
eval {
$sth_insert->execute;
$dbh->{'HandleError'} = $previous_handler;
1;
} or do {
$dbh->rollback;
# Insert failed, try an update
# No check needed because HandleError was restored
$sth_update->execute;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment