From: Shawn M Moore Date: Tue, 28 Aug 2012 09:15:27 +0000 (+0200) Subject: We only need local $? if we inline calls to DEMOLISH X-Git-Tag: 2.0800~24 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMoose.git;a=commitdiff_plain;h=054898323542f0f85865b5d8fad49c3f4ee982c6 We only need local $? if we inline calls to DEMOLISH --- diff --git a/lib/Moose/Meta/Method/Destructor.pm b/lib/Moose/Meta/Method/Destructor.pm index aa3059e..e06a13d 100644 --- a/lib/Moose/Meta/Method/Destructor.pm +++ b/lib/Moose/Meta/Method/Destructor.pm @@ -81,7 +81,6 @@ sub _initialize_body { 'my $self = shift;', 'return ' . $self->_generate_fallback_destructor('$self'), 'if Scalar::Util::blessed($self) ne \'' . $class . '\';', - 'local $?;', $self->_generate_DEMOLISHALL('$self'), 'return;', '}', @@ -118,6 +117,7 @@ sub _generate_DEMOLISHALL { return unless @methods; return ( + 'local $?;', 'my $igd = Devel::GlobalDestruction::in_global_destruction;', 'Try::Tiny::try {', (map { $inv . '->' . $_->{class} . '::DEMOLISH($igd);' } @methods),