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