in reply to RFC: Transactions.pm
Personally, I don't like the package global. I'd prefer something like
my $dbh = DBI->connect(...); transaction $dbh, { for (1..10) { my $sth = $dbh->prepare(...); $sth->execute() or rollback; } };
or even
transaction($dbh) { # code };
to make it look like a for block. I have no idea how to make that work, though.
Also, an additional idea would be to catch die's in the handler and make them execute rollback (which would make your transactions a bit like exceptions).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: RFC: Transactions.pm
by Juerd (Abbot) on Apr 28, 2003 at 11:17 UTC |