Transactions - Example code
 
 
$dbh->{RaiseError} = 1;
$dbh->begin_work;      # AutoCommit off till commit/rollback
eval {
    $dbh->method(…);   # assorted DBI calls
    foo(...);          # application code
    $dbh->commit;      # commit the changes
};
if ($@) {
    warn "Transaction aborted because $@";
    $dbh->rollback;
    ...
}
.