From: Jesse Luehrs Date: Wed, 29 Apr 2009 05:42:10 +0000 (-0500) Subject: pass the in_global_destruction state to DEMOLISHALL and DEMOLISH X-Git-Tag: 0.77~27^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d93592788756e814bd3e98f7a260ec2500065167;p=gitmo%2FMoose.git pass the in_global_destruction state to DEMOLISHALL and DEMOLISH --- diff --git a/lib/Moose/Object.pm b/lib/Moose/Object.pm index 68364db..cc683d3 100644 --- a/lib/Moose/Object.pm +++ b/lib/Moose/Object.pm @@ -56,6 +56,7 @@ sub BUILDALL { sub DEMOLISHALL { my $self = shift; + my ($in_global_destruction) = @_; # NOTE: we ask Perl if we even # need to do this first, to avoid @@ -70,7 +71,7 @@ sub DEMOLISHALL { || Moose::Meta::Class->initialize( ref $self ); foreach my $method ( $meta->find_all_methods_by_name('DEMOLISH') ) { - $method->{code}->execute($self); + $method->{code}->execute($self, $in_global_destruction); } } @@ -80,12 +81,12 @@ sub DESTROY { # localize the $@ ... local $@; # run DEMOLISHALL ourselves, ... - $_[0]->DEMOLISHALL; + $_[0]->DEMOLISHALL(Class::MOP::in_global_destruction); # and return ... return; } # otherwise it is normal destruction - $_[0]->DEMOLISHALL; + $_[0]->DEMOLISHALL(Class::MOP::in_global_destruction); } # support for UNIVERSAL::DOES ...