[Bast-commits] r9441 - in DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage: . DBI/Oracle

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Wed May 26 10:00:19 GMT 2010


Author: ribasushi
Date: 2010-05-26 11:00:19 +0100 (Wed, 26 May 2010)
New Revision: 9441

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
Log:
Can not return from within a try block

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2010-05-26 09:28:36 UTC (rev 9440)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2010-05-26 10:00:19 UTC (rev 9441)
@@ -125,11 +125,22 @@
   my $self = shift;
   my ($dbh, $op, $extra_bind, $ident, $bind_attributes, @args) = @_;
 
-  my $retried;
+  my (@res, $retried);
+  my $wantarray = wantarray();
   my $next = $self->next::can;
   while (1) {
     try {
-      return $self->$next($dbh, $op, $extra_bind, $ident, $bind_attributes, @args);
+      my $exec = sub { $self->$next($dbh, $op, $extra_bind, $ident, $bind_attributes, @args) };
+
+      if (!defined $wantarray) {
+        $exec->();
+      }
+      elsif (! $wantarray) {
+        $res[0] = $exec->();
+      }
+      else {
+        @res = $exec->();
+      }
     }
     catch {
       if (!$retried++ and $_ =~ /ORA-01003/) {
@@ -143,6 +154,8 @@
       }
     };
   }
+
+  return $wantarray ? @res : $res[0];
 }
 
 =head2 get_autoinc_seq

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm	2010-05-26 09:28:36 UTC (rev 9440)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm	2010-05-26 10:00:19 UTC (rev 9441)
@@ -728,8 +728,8 @@
   local $self->{_in_dbh_do} = 1;
 
   my @args = @_;
-  try {
-    return $self->$code ($dbh, @args);
+  return try {
+    $self->$code ($dbh, @args);
   } catch {
     $self->throw_exception($_) if $self->connected;
 




More information about the Bast-commits mailing list