in reply to trapping database errors

What I typically do is:
my $dbh = DBI -> connect ($dsn, $user, $pwd, {RaiseError => 1, PrintError => 0, AutoCommi +t => 0}) or die "Failed to connect: $DBI::errstr\n"; die "Unsetting autocommit failed\n" if $dbh -> {AutoCommit}; eval { my $sth = $dbh -> prepare ($sql); $result = $sth -> execute (@bind); } if ($@) { $dbh -> rollback; die "Database action failed: $@\n"; } else { $dbh -> commit; }

This is for a simple transaction, but if you need to do more actions inside a transaction, you would do all of them inside the eval. Of course, if you want to continue after a failure, you shouldn't do the die.

Abigail