7 use VPIT::TestHelpers threads => [ 'indirect' => 'indirect::I_THREADSAFE()' ];
13 qr/^Indirect call of method "new" on object "$pkg" at \(eval \d+\) line \d+/;
20 my $tid = threads->tid();
24 my $class = "Coconut$tid";
27 local $SIG{__WARN__} = sub { push @warns, @_ };
28 eval 'die "the code compiled but it shouldn\'t have\n";
29 no indirect ":fatal"; my $x = new ' . $class . ' 1, 2;';
31 like $@ || '', expect($class),
32 "\"no indirect\" in eval in thread $tid died as expected";
33 is_deeply \@warns, [ ],
34 "\"no indirect\" in eval in thread $tid didn't warn";
39 skip 'Hints aren\'t propagated into eval STRING below perl 5.10' => 3
41 my $class = "Pineapple$tid";
44 local $SIG{__WARN__} = sub { push @warns, @_ };
45 eval 'return; my $y = new ' . $class . ' 1, 2;';
48 "\"no indirect\" propagated into eval in thread $tid didn't croak";
49 my $first = shift @warns;
50 like $first || '', expect($class),
51 "\"no indirect\" propagated into eval in thread $tid warned once";
52 is_deeply \@warns, [ ],
53 "\"no indirect\" propagated into eval in thread $tid warned just once";
59 my @threads = map spawn(\&try), 1 .. 10;
61 $_->join for @threads;