6 use Test::More tests => 30 * 2 + 2;
16 local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) };
17 eval "die qq{ok\\n}; $_";
22 local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) };
23 eval "die qq{the code compiled but it shouldn't have\n}; $_";
25 like($@, qr/^warn:Indirect\s+call\s+of\s+method\s+"(?:new|meh|HlaghHlagh)"\s+on\s+object\s+"(?:Hlagh|newnew|\$x|\$_)"/, $_);
32 local $SIG{__WARN__} = sub { $warn = join ' ', @_ };
33 eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh1;";
34 like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh1"/, 'no indirect "hlagh" enables the pragma');
35 eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh2;";
36 like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh2"/, 'no indirect "hlagh" doesn\'t croak');
46 $obj = new Hlagh(1, 2);
50 $obj = new Hlagh ( ) ;
52 $obj = new Hlagh ( 1 ) ;
54 $obj = new Hlagh ( 1 , 2 ) ;
81 $obj = new $x qq{foo}, 1;
83 $obj = new $x qr{foo\s+bar}, 1 .. 1;
85 $obj = new $x(qw/bar baz/);
93 $obj = new $_ qr/foo/ ;
95 $obj = new $_ qq(bar baz);
101 $obj = HlaghHlagh Hlagh;
103 $obj = HlaghHlagh Hlagh; # HlaghHlagh Hlagh
107 $obj = new newnew; # new newnew