6 use Test::More tests => 4 + 1 + 1;
10 return qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"$pkg"\s+at\s+\(eval\s+\d+\)\s+line\s+\d+/;
15 local $SIG{__WARN__} = sub { push @warns, "@_" };
22 my $w1 = shift @warns;
23 my $w2 = shift @warns;
24 is $@, "ok\n", 'didn\'t croak without arguments';
25 like $w1, expect('Warn1'), 'first warning caught without arguments';
26 like $w2, expect('Warn2'), 'second warning caught without arguments';
27 is_deeply \@warns, [ ], 'no more warnings without arguments';
31 local $SIG{__WARN__} = sub { die "warn:@_" };
33 die qq{shouldn't even compile\n};
34 no indirect ':fatal', hook => sub { die 'should not be called' };
38 like $@, expect('Fatal'), 'croaks when :fatal is specified';
42 local $SIG{__WARN__} = sub { "warn:@_" };
44 die qq{shouldn't even compile\n};
45 no indirect 'whatever', hook => sub { die 'hook:' . join(':', @_) . "\n" }, ':fatal';
47 $x = new AlsoNotReached;
49 like $@, qr/^hook:Hooked:new:\(eval\s+\d+\):\d+$/, 'calls the specified hook';