From: Matt S Trout Date: Sun, 19 Mar 2006 21:34:28 +0000 (+0000) Subject: Made do_txn respect void context (on the off-chance somebody cares) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eeb342281b10acf6f60b6e5f5f62d365c314a5aa;p=dbsrgits%2FDBIx-Class-Historic.git Made do_txn respect void context (on the off-chance somebody cares) --- diff --git a/Changes b/Changes index d41331e..398f881 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,7 @@ Revision history for DBIx::Class 0.05999_05 - Fixup to columns_info_for when database returns type(size) + - Made do_txn respect void context (on the off-chance somebody cares) 0.05999_04 - Fix for delete on full-table resultsets diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index 21ae980..7df9d5f 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -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; };