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