From: Vincent Pit Date: Mon, 30 Mar 2015 17:14:20 +0000 (-0300) Subject: Revamp PERL_DESTRUCT_LEVEL handling X-Git-Tag: v0.57~20 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=18975a85575a68ddb2e0e0a6ee8075dac66a3c73;p=perl%2Fmodules%2FVariable-Magic.git Revamp PERL_DESTRUCT_LEVEL handling --- diff --git a/t/lib/Variable/Magic/TestGlobalDestruction.pm b/t/lib/Variable/Magic/TestGlobalDestruction.pm index d610dc0..c6639a6 100644 --- a/t/lib/Variable/Magic/TestGlobalDestruction.pm +++ b/t/lib/Variable/Magic/TestGlobalDestruction.pm @@ -73,16 +73,23 @@ sub import { return 0; } - my $env_level = int($ENV{PERL_DESTRUCT_LEVEL} || 0); - if ($env_level >= $level) { - my $is_debugging = is_debugging_perl(); + my $env_level = $ENV{PERL_DESTRUCT_LEVEL}; + if (defined $env_level) { + $env_level = do { + no warnings 'numeric'; + int $env_level; + }; + my $is_debugging = is_debugging_perl(); if ($is_debugging) { - _diag("Global destruction level $env_level set by PERL_DESTRUCT_LEVEL (debugging perl)"); - return 1; + my $ignoring = $env_level < $level ? ', ignoring' : ''; + _diag("Global destruction level $env_level set by PERL_DESTRUCT_LEVEL (debugging perl)$ignoring"); + unless ($ignoring) { + return 1; + } + } else { + _diag("PERL_DESTRUCT_LEVEL is set to $env_level, but this perl doesn't seem to have debugging enabled, ignoring"); } - - _diag("PERL_DESTRUCT_LEVEL is set to $env_level, but this perl doesn't seem to have debugging enabled"); } my $has_perl_destruct_level = do {