7 use autovivification::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.008_002;
26 my $status = run_perl <<' RUN';
29 $code -= threads->create(sub {
30 eval q{no autovivification; my $x; my $y = $x->{foo}; $x};
31 return defined($x) ? 0 : 1;
33 $code -= defined(eval q{my $x; my $y = $x->{foo}; $x}) ? 2 : 0;
34 $code -= defined(eval q{no autovivification; my $x; my $y = $x->{foo}; $x})
38 is $status, 0, 'loading the pragma in a thread and using it outside doesn\'t segfault';