# If RaiseError is false, begin_work() will: # return true if a new transaction was started # return false if already in a transaction # croak if transactions not supported # my $started_a_new_transaction = 0; eval { local $dbh->{RaiseError} = 0; $started_a_new_transaction = $dbh->begin_work; }; $self->{_can_do_transactions} = $@ ? 0 : 1; eval { $dbh->rollback } if $started_a_new_transaction;