but with this, perl won't do anything at all
Jesse Luehrs [Sun, 24 Apr 2011 15:38:35 +0000 (10:38 -0500)]
perl seems to silently convert exceptions thrown in destructors into
warnings, in the category of "misc", so disabling misc warnings means
that exceptions in the destructor will be completely silent. confess
inside destructors seems to be completely silent regardless, which also
seems broken, but nothing we can really do about that. don't really want
to add tests for this, because it's really not clear what the intended
behavior is here.

lib/Moose/Meta/Method/Destructor.pm
lib/Moose/Object.pm

index 182f15e..2ce956d 100644 (file)
@@ -122,7 +122,6 @@ sub _generate_DEMOLISHALL {
             (map { $inv . '->' . $_->{class} . '::DEMOLISH($igd);' } @methods),
         '}',
         'Try::Tiny::catch {',
-            'no warnings \'misc\';',
             'die $_;',
         '};',
     );
index e47ad9c..1143231 100644 (file)
@@ -92,9 +92,6 @@ sub DESTROY {
         $self->DEMOLISHALL(Devel::GlobalDestruction::in_global_destruction);
     }
     Try::Tiny::catch {
-        # Without this, Perl will warn "\t(in cleanup)$@" because of some
-        # bizarre fucked-up logic deep in the internals.
-        no warnings 'misc';
         die $_;
     };