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