X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI.pm;h=1eec464c8be1d6dfc3e104e3c7c02c21527a8762;hb=38ed54cd3980bd344e13fad27ed11b935ae932aa;hp=1630180f960130a486fbfa9ab77df5d32ca99731;hpb=9e34d55419481925691c7177d43ba48ec02b02eb;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 1630180..1eec464 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -732,9 +732,10 @@ sub dbh_do { local $self->{_in_dbh_do} = 1; - my @args = @_; + # take a ref instead of a copy, to preserve coderef @_ aliasing semantics + my $args = \@_; return try { - $self->$code ($dbh, @args); + $self->$code ($dbh, @$args); } catch { $self->throw_exception($_) if $self->connected; @@ -744,7 +745,7 @@ sub dbh_do { if $ENV{DBIC_DBIRETRY_DEBUG}; $self->_populate_dbh; - $self->$code($self->_dbh, @args); + $self->$code($self->_dbh, @$args); }; } @@ -768,19 +769,22 @@ sub txn_do { my $tried = 0; while(1) { my $exception; - my @args = @_; + + # take a ref instead of a copy, to preserve coderef @_ aliasing semantics + my $args = \@_; + try { $self->_get_dbh; $self->txn_begin; if($want_array) { - @result = $coderef->(@args); + @result = $coderef->(@$args); } elsif(defined $want_array) { - $result[0] = $coderef->(@args); + $result[0] = $coderef->(@$args); } else { - $coderef->(@args); + $coderef->(@$args); } $self->txn_commit; } catch {