From: gfx Date: Sat, 28 Nov 2009 07:40:39 +0000 (+0900) Subject: Skip class unload stuff in global destruction X-Git-Tag: 0.40_09~22 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=39a8df6342dd38b9e489f25ed48d9c3d79e1e288;p=gitmo%2FMouse.git Skip class unload stuff in global destruction --- diff --git a/lib/Mouse/Meta/Module.pm b/lib/Mouse/Meta/Module.pm index 93b6f68..8a4ccb9 100755 --- a/lib/Mouse/Meta/Module.pm +++ b/lib/Mouse/Meta/Module.pm @@ -265,6 +265,8 @@ sub get_method_list { sub DESTROY{ my($self) = @_; + return if $Mouse::Util::in_global_destruction; + my $serial_id = $self->{anon_serial_id}; return if !$serial_id; diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index 2de5935..c3f1f39 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -88,6 +88,8 @@ BEGIN { generate_isa_predicate_for('Mouse::Meta::Role' => 'is_a_metarole'); } +our $in_global_destruction = 0; +END{ $in_global_destruction = 1 } # Moose::Util compatible utilities