[Bast-commits] r9377 - DBIx-Class/0.08/branches/try-tiny/lib/DBIx/Class

tonvoon at dev.catalyst.perl.org tonvoon at dev.catalyst.perl.org
Fri May 14 22:45:27 GMT 2010


Author: tonvoon
Date: 2010-05-14 23:45:27 +0100 (Fri, 14 May 2010)
New Revision: 9377

Modified:
   DBIx-Class/0.08/branches/try-tiny/lib/DBIx/Class/Storage.pm
Log:
Corrected usage of $@ in catch block


Modified: DBIx-Class/0.08/branches/try-tiny/lib/DBIx/Class/Storage.pm
===================================================================
--- DBIx-Class/0.08/branches/try-tiny/lib/DBIx/Class/Storage.pm	2010-05-14 22:22:57 UTC (rev 9376)
+++ DBIx-Class/0.08/branches/try-tiny/lib/DBIx/Class/Storage.pm	2010-05-14 22:45:27 UTC (rev 9377)
@@ -161,9 +161,10 @@
   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 @@
     }
     $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/;




More information about the Bast-commits mailing list