Commit | Line | Data |
5ae49e26 |
1 | #!/usr/bin/perl -T |
2 | use strict; |
3 | use warnings; |
4 | |
5 | use 5.008000; # for ${^TAINT} |
dcddf99e |
6 | use Test::More tests => 2; |
5ae49e26 |
7 | use Module::Metadata; |
dcddf99e |
8 | use Carp 'croak'; |
9 | |
10 | # stolen liberally from Class-Tiny/t/lib/TestUtils.pm - thanks xdg! |
11 | sub exception(&) { |
12 | my $code = shift; |
13 | my $success = eval { $code->(); 1 }; |
14 | my $err = $@; |
15 | return undef if $success; # original returned '' |
16 | croak "Execution died, but the error was lost" unless $@; |
17 | return $@; |
18 | } |
5ae49e26 |
19 | |
20 | ok(${^TAINT}, 'taint flag is set'); |
21 | |
22 | # without the fix, we get: |
23 | # Insecure dependency in eval while running with -T switch at lib/Module/Metadata.pm line 668, <GEN0> line 15. |
24 | is( |
25 | exception { Module::Metadata->new_from_module( "Module::Metadata" )->version }, |
26 | undef, |
27 | 'no exception', |
28 | ); |
29 | |