6 use Config qw/%Config/;
9 if (!$Config{useithreads}) {
12 plan(skip_all => 'This perl wasn\'t built to support threads');
21 delete $ENV{PERL_INDIRECT_PM_DISABLE};
23 if (indirect::I_THREADSAFE()) {
25 defined and diag "Using threads $_" for $threads::VERSION;
27 plan skip_all => 'This indirect isn\'t thread safe';
34 my $SystemRoot = $ENV{SystemRoot};
36 $ENV{SystemRoot} = $SystemRoot if $^O eq 'MSWin32' and defined $SystemRoot;
38 system { $^X } $^X, '-T', map("-I$_", @INC), '-e', $code;
43 skip 'Fails on 5.8.2 and lower' => 1 if $] <= 5.008002;
45 my $status = run_perl <<' RUN';
46 my ($code, @expected);
51 sub cb { --$code if $_[0] eq shift(@expected) || q{DUMMY} }
53 $code = threads->create(sub {
54 eval q{return; no indirect hook => \&cb; new X;};
58 eval q{return; no indirect hook => \&cb; new Z;};
61 is $status, 0, 'loading the pragma in a thread and using it outside doesn\'t segfault';