# this is either part of core or set up appropriately by MRO::Compat
*check_package_cache_flag = \&mro::get_pkg_gen;
+
+ eval {
+ require Devel::GlobalDestruction;
+ Devel::GlobalDestruction->import("in_global_destruction");
+ 1;
+ } or *in_global_destruction = sub () { '' };
}
return $class->create($package_name, %options);
}
- BEGIN {
- local $@;
- eval {
- require Devel::GlobalDestruction;
- Devel::GlobalDestruction->import("in_global_destruction");
- 1;
- } or *in_global_destruction = sub () { '' };
- }
-
# NOTE:
# this will only get called for
# anon-classes, all other calls
sub DESTROY {
my $self = shift;
- return if in_global_destruction; # it'll happen soon anyway and this just makes things more complicated
+ return if Class::MOP::in_global_destruction; # it'll happen soon anyway and this just makes things more complicated
no warnings 'uninitialized';
return unless $self->name =~ /^$ANON_CLASS_PREFIX/;