test for taint mode using perl 5.6 compatible method
[p5sagit/Module-Metadata.git] / t / taint.t
old mode 100644 (file)
new mode 100755 (executable)
index ef527de..80ae7ea
--- a/t/taint.t
+++ b/t/taint.t
@@ -2,7 +2,6 @@
 use strict;
 use warnings;
 
-use 5.008000;   # for ${^TAINT}
 use Test::More tests => 2;
 use Module::Metadata;
 use Carp 'croak';
@@ -17,7 +16,8 @@ sub exception(&) {
     return $@;
 }
 
-ok(${^TAINT}, 'taint flag is set');
+my $taint_on = ! eval { no warnings; join('',values %ENV), kill 0; 1; };
+ok($taint_on, 'taint flag is set');
 
 # without the fix, we get:
 # Insecure dependency in eval while running with -T switch at lib/Module/Metadata.pm line 668, <GEN0> line 15.