update
delete
dbh
+ txn_do
txn_commit
txn_rollback
sth
};
##Reset to the original state
- $self->schema->storage->read_handler($current);
+ $self->read_handler($current);
##Exception testing has to come last, otherwise you might leave the
##read_handler set to master.
$schema->storage->read_handler($write_handler);
}
-=head2 txn_do ($coderef)
+=head2 around: txn_do ($coderef)
Overload to the txn_do method, which is delegated to whatever the
L<write_handler> is set to. We overload this in order to wrap in inside a
=cut
-sub txn_do {
- my($self, $coderef, @args) = @_;
- $self->execute_reliably($coderef, @args);
-}
+around 'txn_do' => sub {
+ my($txn_do, $self, $coderef, @args) = @_;
+ $self->execute_reliably(sub {$self->$txn_do($coderef, @args)});
+};
=head2 reload_row ($row)
around 'reload_row' => sub {
my ($reload_row, $self, $row) = @_;
- $self->execute_reliably(sub {
- $self->$reload_row(shift);
+ return $self->execute_reliably(sub {
+ return $self->$reload_row(shift);
}, $row);
};