in reply to trapping database errors
$sth->execute($sqla) or failover($sth->errstr); sub failover() { my $error = shift; $dbh->rollback # If needed; $dbh->disconnect; $mailbody .= "Cannot insert into $database : $error\n"; } [download]