12 use Test::More tests => 50 * 6 + 2;
22 return qr/^warn:Indirect call of method "(?:new|meh|$pkg$pkg)" on object "(?:$pkg|newnew|\$(?:[xyz_\$]|(?:sploosh::)?sploosh|(?:main::)?bloop))"/
30 local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) };
33 eval "die qq{ok\\n}; $_";
35 is($@, "ok\n", "use indirect: $_");
38 eval "die qq{the code compiled but it shouldn't have\n}; $_";
40 like($@, expect('Hlagh'), "no indirect: $_");
44 eval "die qq{ok\\n}; $_";
46 is($@, "ok\n", "use indirect, defined: $_");
49 eval "die qq{the code compiled but it shouldn't have\n}; $_";
51 like($@, expect('Dongs'), "no indirect, defined: $_");
56 eval "die qq{ok\\n}; $_";
58 is($@, "ok\n", "use indirect, spaces: $_");
61 eval "die qq{the code compiled but it shouldn't have\n}; $_";
63 like($@, expect('Hlagh'), "no indirect, spaces: $_");
70 local $SIG{__WARN__} = sub { $warn = join ' ', @_ };
71 eval "die qq{ok\n}; \$obj = new Hlagh1;";
72 is($@, "ok\n", 'no indirect "hlagh" didn\'t croak');
73 like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh1"/, 'no indirect "hlagh" enables the pragma');
83 $obj = new Hlagh(1, 2);
87 $obj = new Hlagh ( ) ;
89 $obj = new Hlagh ( 1 ) ;
91 $obj = new Hlagh ( 1 , 2 ) ;
116 $obj = new $x('foo');
118 $obj = new $x qq{foo}, 1;
120 $obj = new $x qr{foo\s+bar}, 1 .. 1;
122 $obj = new $x(qw/bar baz/);
130 $obj = new $_ qr/foo/ ;
132 $obj = new $_ qq(bar baz);
162 meh $sploosh::sploosh;
180 meh $sploosh::sploosh;
186 new Hlagh->wut, "Wut";
188 $obj = HlaghHlagh Hlagh;
190 $obj = HlaghHlagh Hlagh; # HlaghHlagh Hlagh
194 $obj = new newnew; # new newnew