From: Dagfinn Ilmari Mannsåker Date: Tue, 29 Oct 2013 17:00:53 +0000 (+0000) Subject: Explicitly stringify when checking for existing exception X-Git-Tag: v0.08260~102 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=935ea660e323a5f4cfd771eec082d0aa4a81b7bd;p=dbsrgits%2FDBIx-Class.git Explicitly stringify when checking for existing exception This fixes errors with exception objects with incomplete overloading (like Log::Report::Dispatcher::Try). --- diff --git a/lib/DBIx/Class/Storage/TxnScopeGuard.pm b/lib/DBIx/Class/Storage/TxnScopeGuard.pm index 580a32b..844b2cc 100644 --- a/lib/DBIx/Class/Storage/TxnScopeGuard.pm +++ b/lib/DBIx/Class/Storage/TxnScopeGuard.pm @@ -23,7 +23,7 @@ sub new { # FIXME FRAGILE - any eval that fails but *does not* rethrow between here # and the unwind will trample over $@ and invalidate the entire mechanism # There got to be a saner way of doing this... - if (defined $@ and $@ ne '') { + if (defined $@ and "$@" ne '') { weaken( $guard->{existing_exception_ref} = (ref $@ ne '') ? $@ : \$@ ); @@ -60,7 +60,7 @@ sub DESTROY { my $exception = $@ if ( defined $@ and - $@ ne '' + "$@" ne '' and ( ! defined $self->{existing_exception_ref}