12 use Test::More tests => 44 * 4 + 2;
21 local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) };
24 eval "die qq{ok\\n}; $_";
26 is($@, "ok\n", "use indirect: $_");
29 eval "die qq{the code compiled but it shouldn't have\n}; $_";
31 like($@, qr/^warn:Indirect\s+call\s+of\s+method\s+"(?:new|meh|HlaghHlagh)"\s+on\s+object\s+"(?:Hlagh|newnew|\$[xy_]|\$(?:sploosh::)?sploosh|\$(?:main::)?bloop)"/, "no indirect: $_");
35 eval "die qq{ok\\n}; $_";
37 is($@, "ok\n", "use indirect, defined: $_");
40 eval "die qq{the code compiled but it shouldn't have\n}; $_";
42 like($@, qr/^warn:Indirect\s+call\s+of\s+method\s+"(?:new|meh|DongsDongs)"\s+on\s+object\s+"(?:Dongs|newnew|\$[xy_]|\$(?:sploosh::)?sploosh|\$(?:main::)?bloop)"/, "no indirect, defined: $_");
49 local $SIG{__WARN__} = sub { $warn = join ' ', @_ };
50 eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh1;";
51 like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh1"/, 'no indirect "hlagh" enables the pragma');
52 eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh2;";
53 like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh2"/, 'no indirect "hlagh" doesn\'t croak');
63 $obj = new Hlagh(1, 2);
67 $obj = new Hlagh ( ) ;
69 $obj = new Hlagh ( 1 ) ;
71 $obj = new Hlagh ( 1 , 2 ) ;
98 $obj = new $x qq{foo}, 1;
100 $obj = new $x qr{foo\s+bar}, 1 .. 1;
102 $obj = new $x(qw/bar baz/);
110 $obj = new $_ qr/foo/ ;
112 $obj = new $_ qq(bar baz);
132 meh $sploosh::sploosh;
147 meh $sploosh::sploosh;
153 new Hlagh->wut, "Wut";
155 $obj = HlaghHlagh Hlagh;
157 $obj = HlaghHlagh Hlagh; # HlaghHlagh Hlagh
161 $obj = new newnew; # new newnew