On Wed, Mar 31, 2004 at 04:08:09PM +0100, Tim Bunce wrote:
> sub perform_transaction {
> my ($dbh, $coderef, $allow_non_transaction) = @_;
I suggest not taking any (non-coderef) arguments after $coderef, because
they can easily get lost visually:
$dbh->perform_transaction(sub {
.
.
.
}, 1);
I know you want $allow_non_transaction to be optional and usually
absent, but I still think that putting it after the coderef is a trap.
Maybe $dbh->perform_transaction_unsafe or some similarly alarming name?
I also agree with the suggestion for a rollback coderef, which I think
can be passed (optionally) after the body coderef.
Other than that, looks fine.
Andrew