Made do_txn respect void context (on the off-chance somebody cares)
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Schema.pm
index 21ae980..7df9d5f 100644 (file)
@@ -451,10 +451,16 @@ sub txn_do {
   eval {
     # Need to differentiate between scalar/list context to allow for returning
     # a list in scalar context to get the size of the list
+
     if ($wantarray) {
+      # list context
       @return_values = $coderef->(@args);
-    } else {
+    } elsif (defined $wantarray) {
+      # scalar context
       $return_value = $coderef->(@args);
+    } else {
+      # void context
+      $coderef->(@args);
     }
     $self->txn_commit;
   };