X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage.pm;h=0575c32fbf24b813c069fb8c393bcfc1da855e86;hb=0d7d16dd7fa107999e0a89fdbd954a3a261d81e2;hp=08ea155f3ca309ac150fd460e4030ac861c8ca35;hpb=20674fcd94984d0d2be09ecda7f3c22715468936;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index 08ea155..0575c32 100644 --- a/lib/DBIx/Class/Storage.pm +++ b/lib/DBIx/Class/Storage.pm @@ -161,9 +161,10 @@ For example, try { $rs = $schema->txn_do($coderef); } catch { + my $error = shift; # Transaction failed die "something terrible has happened!" # - if ($@ =~ /Rollback failed/); # Rollback failed + if ($error =~ /Rollback failed/); # Rollback failed deal_with_failed_transaction(); }; @@ -194,7 +195,7 @@ sub txn_do { $self->txn_begin; # If this throws an exception, no rollback is needed my $wantarray = wantarray; # Need to save this since the context - # inside the eval{} block is independent + # inside the try{} block is independent # of the context that called txn_do() try { @@ -212,12 +213,12 @@ sub txn_do { } $self->txn_commit; } catch { - my $error = $@; + my $error = shift; try { $self->txn_rollback; } catch { - my $rollback_error = $@; + my $rollback_error = shift; my $exception_class = "DBIx::Class::Storage::NESTED_ROLLBACK_EXCEPTION"; $self->throw_exception($error) # propagate nested rollback if $rollback_error =~ /$exception_class/;