7 use indirect::TestThreads;
9 use Test::Leaner tests => 1;
14 my ($SystemRoot, $PATH) = @ENV{qw<SystemRoot PATH>};
16 $ENV{SystemRoot} = $SystemRoot if $^O eq 'MSWin32' and defined $SystemRoot;
17 $ENV{PATH} = $PATH if $^O eq 'cygwin' and defined $PATH;
19 system { $^X } $^X, '-T', map("-I$_", @INC), '-e', $code;
24 skip 'Fails on 5.8.2 and lower' => 1 if "$]" <= 5.008002;
26 my $status = run_perl <<' RUN';
27 my ($code, @expected);
32 sub cb { --$code if $_[0] eq shift(@expected) || q{DUMMY} }
34 $code = threads->create(sub {
35 eval q{return; no indirect hook => \&cb; new X;};
39 eval q{return; no indirect hook => \&cb; new Z;};
42 is $status, 0, 'loading the pragma in a thread and using it outside doesn\'t segfault';