From: Ton Voon Date: Fri, 14 May 2010 22:45:27 +0000 (+0000) Subject: Corrected usage of $@ in catch block X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6b89ee0be195a8df0147a3ef6fd03f27c0c7c7fd;p=dbsrgits%2FDBIx-Class-Historic.git Corrected usage of $@ in catch block --- diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index 08ea155..0e092ee 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(); }; @@ -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/;