X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FMethod%2FDestructor.pm;h=7c12dc85636c41682cecfa91b9a77373893b7da4;hp=66f4709f739dc68372a0f1165e52340941465a11;hb=9b9e4b6566015d6d6e2aa6c745644174efa74623;hpb=0126c27c413cb63f67e66e09b0fdfeb92117503a diff --git a/lib/Mouse/Meta/Method/Destructor.pm b/lib/Mouse/Meta/Method/Destructor.pm index 66f4709..7c12dc8 100644 --- a/lib/Mouse/Meta/Method/Destructor.pm +++ b/lib/Mouse/Meta/Method/Destructor.pm @@ -13,6 +13,7 @@ sub _generate_destructor{ my $demolishall = ''; for my $class ($metaclass->linearized_isa) { no strict 'refs'; + no warnings 'once'; if (*{$class . '::DEMOLISH'}{CODE}) { $demolishall .= "${class}::DEMOLISH(\$self);\n"; } @@ -21,7 +22,17 @@ sub _generate_destructor{ my $source = sprintf("#line %d %s\n", __LINE__, __FILE__) . <<"..."; sub { my \$self = shift; - $demolishall; + local \$?; + + my \$e = do{ + local \$@; + eval{ + $demolishall; + }; + \$@; + }; + no warnings 'misc'; + die \$e if \$e; # rethrow } ... @@ -37,3 +48,17 @@ sub _generate_destructor{ 1; __END__ + +=head1 NAME + +Mouse::Meta::Method::Accessor - A Mouse method generator for destructors + +=head1 VERSION + +This document describes Mouse version 0.39 + +=head1 SEE ALSO + +L + +=cut