X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDevel%2FGlobalDestruction.pm;h=949d1d4e83d841bc30e3ed9685b2d329ecb03b86;hb=5629eb97bd5b25e57bec2dc3920728b7a89a4e29;hp=25b895881e2cd4f7a12ce3e62f89283c53ea7962;hpb=23135b02f4a06a25ad3626ca40d8c171b379f25f;p=p5sagit%2FDevel-GlobalDestruction.git diff --git a/lib/Devel/GlobalDestruction.pm b/lib/Devel/GlobalDestruction.pm index 25b8958..949d1d4 100644 --- a/lib/Devel/GlobalDestruction.pm +++ b/lib/Devel/GlobalDestruction.pm @@ -27,9 +27,15 @@ elsif (eval { } else { # internally, PL_main_start is nulled immediately before entering global destruction - # and we can use B to detect that + # and we can use B to detect that. It will also be null before the main runloop starts, + # so we check install a CHECK if needed to detect that. require B; - eval 'sub in_global_destruction () { B::main_start()->isa(q[B::NULL]) }; 1' + my $started = !B::main_start()->isa(q[B::NULL]); + unless ($started) { + eval 'CHECK { $started = 1 }; 1' + or die $@; + } + eval 'sub in_global_destruction () { $started && B::main_start()->isa(q[B::NULL]) }; 1' or die $@; }