'Sub::Identify' => '0.03',
'MRO::Compat' => '0.05',
'Carp' => 0,
+ 'Devel::GlobalDestruction' => 0,
);
-delete $prereqs{'Sub::Name'}
+delete @prereqs{qw(Sub::Name Devel::GlobalDestruction)}
unless $has_compiler;
write_makefile();
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
# really need to be handled explicitly
sub DESTROY {
my $self = shift;
+
+ 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_CLASS_PREFIX/;
my ($serial_id) = ($self->name =~ /^$ANON_CLASS_PREFIX(\d+)/);