12 use Test::More tests => 46 * 6 + 2;
19 return qr/^warn:Indirect call of method "(?:new|meh|$pkg$pkg)" on object "(?:$pkg|newnew|\$(?:[xy_\$]|(?:sploosh::)?sploosh|(?:main::)?bloop))"/
27 local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) };
30 eval "die qq{ok\\n}; $_";
32 is($@, "ok\n", "use indirect: $_");
35 eval "die qq{the code compiled but it shouldn't have\n}; $_";
37 like($@, expect('Hlagh'), "no indirect: $_");
41 eval "die qq{ok\\n}; $_";
43 is($@, "ok\n", "use indirect, defined: $_");
46 eval "die qq{the code compiled but it shouldn't have\n}; $_";
48 like($@, expect('Dongs'), "no indirect, defined: $_");
53 eval "die qq{ok\\n}; $_";
55 is($@, "ok\n", "use indirect, spaces: $_");
58 eval "die qq{the code compiled but it shouldn't have\n}; $_";
60 like($@, expect('Hlagh'), "no indirect, spaces: $_");
67 local $SIG{__WARN__} = sub { $warn = join ' ', @_ };
68 eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh1;";
69 like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh1"/, 'no indirect "hlagh" enables the pragma');
70 eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh2;";
71 like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh2"/, 'no indirect "hlagh" doesn\'t croak');
81 $obj = new Hlagh(1, 2);
85 $obj = new Hlagh ( ) ;
87 $obj = new Hlagh ( 1 ) ;
89 $obj = new Hlagh ( 1 , 2 ) ;
114 $obj = new $x('foo');
116 $obj = new $x qq{foo}, 1;
118 $obj = new $x qr{foo\s+bar}, 1 .. 1;
120 $obj = new $x(qw/bar baz/);
128 $obj = new $_ qr/foo/ ;
130 $obj = new $_ qq(bar baz);
154 meh $sploosh::sploosh;
169 meh $sploosh::sploosh;
175 new Hlagh->wut, "Wut";
177 $obj = HlaghHlagh Hlagh;
179 $obj = HlaghHlagh Hlagh; # HlaghHlagh Hlagh
183 $obj = new newnew; # new newnew