]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/lib/Variable/Magic/TestGlobalDestruction.pm
Always honor $ENV{PERL_DESTRUCT_LEVEL} when it's set for a debugging perl
[perl/modules/Variable-Magic.git] / t / lib / Variable / Magic / TestGlobalDestruction.pm
index c6639a63ba3e2d8e3e6815d0dc604be7c096af54..b616a8e74c171ed859597893121a98fb67915bbd 100644 (file)
@@ -68,7 +68,7 @@ sub import {
  my $level = $args{level};
  $level    = 1 unless defined $level;
 
- if ("$]" < 5.013_004 and not $ENV{PERL_VARIABLE_MAGIC_TEST_THREADS}) {
+ if ("$]" < 5.013_004 and not $ENV{PERL_FORCE_TEST_THREADS}) {
   _diag("perl 5.13.4 required to safely test global destruction");
   return 0;
  }
@@ -82,11 +82,8 @@ sub import {
 
   my $is_debugging = is_debugging_perl();
   if ($is_debugging) {
-   my $ignoring = $env_level < $level ? ', ignoring' : '';
-   _diag("Global destruction level $env_level set by PERL_DESTRUCT_LEVEL (debugging perl)$ignoring");
-   unless ($ignoring) {
-    return 1;
-   }
+   _diag("Global destruction level $env_level set by PERL_DESTRUCT_LEVEL (debugging perl)");
+   return ($env_level >= $level) ? 1 : 0;
   } else {
    _diag("PERL_DESTRUCT_LEVEL is set to $env_level, but this perl doesn't seem to have debugging enabled, ignoring");
   }