X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FReplicated.pm;h=a21c413cf5547fbf4ab61c93c754bb2c9c940c5f;hb=6834cc1d0449dfc1f528a1b9ecaf4f1a98ae0794;hp=efabb0558b3b101d03ba7a92fd34e21701e508ec;hpb=ed213e857791d1cfb0f1a0e32674e81358e19564;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/Replicated.pm b/lib/DBIx/Class/Storage/DBI/Replicated.pm index efabb05..a21c413 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated.pm @@ -224,6 +224,7 @@ has 'write_handler' => ( update delete dbh + txn_do txn_commit txn_rollback sth @@ -428,7 +429,7 @@ sub execute_reliably { }; ##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. @@ -470,7 +471,7 @@ sub set_balanced_storage { $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 is set to. We overload this in order to wrap in inside a @@ -478,10 +479,10 @@ L method. =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) @@ -492,8 +493,8 @@ the master storage. 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); };