From: Chris Prather Date: Thu, 30 Apr 2009 04:03:39 +0000 (-0400) Subject: swap instance of Class::MOP::in_global_destruction to Devel::GlobalDestruction in_glo... X-Git-Tag: 0.77~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=963c24e1dd4e24c81cfced5e35ed072e7bc5dd5b;p=gitmo%2FMoose.git swap instance of Class::MOP::in_global_destruction to Devel::GlobalDestruction in_global_destruction --- diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index dcca38f..f1f847a 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -8,6 +8,7 @@ use metaclass; use Scalar::Util 'blessed'; use Carp 'confess'; use Sub::Name 'subname'; +use Devel::GlobalDestruction 'in_global_destruction'; our $VERSION = '0.76'; $VERSION = eval $VERSION; @@ -555,7 +556,7 @@ sub create { sub DESTROY { my $self = shift; - return if Class::MOP::in_global_destruction(); # it'll happen soon anyway and this just makes things more complicated + return if in_global_destruction(); # it'll happen soon anyway and this just makes things more complicated no warnings 'uninitialized'; return unless $self->name =~ /^$ANON_ROLE_PREFIX/; diff --git a/lib/Moose/Object.pm b/lib/Moose/Object.pm index e2a8b99..974908d 100644 --- a/lib/Moose/Object.pm +++ b/lib/Moose/Object.pm @@ -5,6 +5,7 @@ use strict; use warnings; use Scalar::Util; +use Devel::GlobalDestruction qw(in_global_destruction); use if ( not our $__mx_is_compiled ), 'Moose::Meta::Class'; use if ( not our $__mx_is_compiled ), metaclass => 'Moose::Meta::Class'; @@ -81,12 +82,12 @@ sub DESTROY { # localize the $@ ... local $@; # run DEMOLISHALL ourselves, ... - $_[0]->DEMOLISHALL(Class::MOP::in_global_destruction); + $_[0]->DEMOLISHALL(in_global_destruction); # and return ... return; } # otherwise it is normal destruction - $_[0]->DEMOLISHALL(Class::MOP::in_global_destruction); + $_[0]->DEMOLISHALL(in_global_destruction); } # support for UNIVERSAL::DOES ...