From: Peter Rabbitson Date: Tue, 10 May 2011 00:14:40 +0000 (+0200) Subject: Fix incorrect > vs >= ver. check, causing 5.13.1 fails X-Git-Tag: v0.08192~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b4ad8a74b2a7d41e0089af9514bf82753e9faf7a;p=dbsrgits%2FDBIx-Class.git Fix incorrect > vs >= ver. check, causing 5.13.1 fails --- diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index 9a545ce..220ba73 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -21,6 +21,12 @@ BEGIN { : sub () { 0 } ; + # There was a brief period of p5p insanity when $@ was invisible in a DESTROY + *INVISIBLE_DOLLAR_AT = ($] >= 5.013001 and $] <= 5.013007) + ? sub () { 1 } + : sub () { 0 } + ; + # During 5.13 dev cycle HELEMs started to leak on copy *PEEPEENESS = (defined $ENV{DBICTEST_ALL_LEAKS} # request for all tests would force "non-leaky" illusion and vice-versa @@ -41,6 +47,7 @@ BEGIN { else { 0 } } ) ? sub () { 1 } : sub () { 0 }; + } use mro 'c3'; diff --git a/lib/DBIx/Class/Storage/TxnScopeGuard.pm b/lib/DBIx/Class/Storage/TxnScopeGuard.pm index 5b72f68..0979a26 100644 --- a/lib/DBIx/Class/Storage/TxnScopeGuard.pm +++ b/lib/DBIx/Class/Storage/TxnScopeGuard.pm @@ -4,21 +4,9 @@ use strict; use warnings; use Try::Tiny; use Scalar::Util qw/weaken blessed/; +use DBIx::Class; use DBIx::Class::Exception; use DBIx::Class::Carp; - -# temporary until we fix the $@ issue in core -# we also need a real appendable, stackable exception object -# (coming soon) -BEGIN { - if ($] >= 5.013001 and $] <= 5.013007) { - *IS_BROKEN_PERL = sub () { 1 }; - } - else { - *IS_BROKEN_PERL = sub () { 0 }; - } -} - use namespace::clean; my ($guards_count, $compat_handler, $foreign_handler); @@ -31,7 +19,7 @@ sub new { # install a callback carefully - if (IS_BROKEN_PERL and !$guards_count) { + if (DBIx::Class::_ENV_::INVISIBLE_DOLLAR_AT and !$guards_count) { # if the thrown exception is a plain string, wrap it in our # own exception class @@ -83,7 +71,7 @@ sub DESTROY { # don't touch unless it's ours, and there are no more of us left if ( - IS_BROKEN_PERL + DBIx::Class::_ENV_::INVISIBLE_DOLLAR_AT and !$guards_count ) { @@ -148,7 +136,7 @@ sub DESTROY { } } - $@ = $exception unless IS_BROKEN_PERL; + $@ = $exception unless DBIx::Class::_ENV_::INVISIBLE_DOLLAR_AT; } 1; diff --git a/t/52leaks.t b/t/52leaks.t index ce6d14c..5111b67 100644 --- a/t/52leaks.t +++ b/t/52leaks.t @@ -291,9 +291,8 @@ for my $slot (keys %$weak_registry) { delete $weak_registry->{$slot} unless $cleared->{hash_merge_singleton}{$weak_registry->{$slot}{weakref}{behavior}}++; } - elsif ($slot =~ /^__TxnScopeGuard__FIXUP__/) { + elsif (DBIx::Class::_ENV_::INVISIBLE_DOLLAR_AT and $slot =~ /^__TxnScopeGuard__FIXUP__/) { delete $weak_registry->{$slot} - if $] > 5.013001 and $] < 5.013008; } elsif ($slot =~ /^DateTime::TimeZone/) { # DT is going through a refactor it seems - let it leak zones for now