Localize all status vars in DEMOLISH
[gitmo/Moose.git] / lib / Moose / Object.pm
index 7cb1e73..fefdfe3 100644 (file)
@@ -86,17 +86,9 @@ sub DEMOLISHALL {
 }
 
 sub DESTROY {
-    # if we have an exception here ...
-    if ($@) {
-        # localize the $@ ...
-        local $@;
-        # run DEMOLISHALL ourselves, ...
-        $_[0]->DEMOLISHALL(in_global_destruction);
-        # and return ...
-        return;
-    }
-    # otherwise it is normal destruction
+    local ( $., $@, $!, $^E, $? );
     $_[0]->DEMOLISHALL(in_global_destruction);
+    return;
 }
 
 # support for UNIVERSAL::DOES ...