5 if ($ENV{DEVEL_GLOBALDESTRUCTION_PP_TEST}) {
7 die 'no XS' if $_[1] eq 'Devel/GlobalDestruction/XS.pm';
13 package Test::Scope::Guard;
14 sub new { my ($class, $code) = @_; bless [$code], $class; }
15 sub DESTROY { my $self = shift; $self->[0]->() }
20 # doesn't always work when loaded in gd, so pre-load it
21 use Sub::Exporter::Progressive ();
26 our $alive = Test::Scope::Guard->new(sub {
27 require Devel::GlobalDestruction;
28 my $gd = Devel::GlobalDestruction::in_global_destruction();
29 print(($gd ? '' : 'not ') . "ok 3 - global destruct detected when loaded during GD\n");
33 print(($alive ? '' : 'not ') . "ok 1 - alive during runtime\n");
35 print(($alive ? '' : 'not ') . "ok 2 - alive during END\n");