12 use Test::More tests => 44 * 6 + 2;
19 return qr/^warn:Indirect call of method "(?:new|meh|$pkg$pkg)" on object "(?:$pkg|newnew|\$(?:[xy_]|(?:sploosh::)?sploosh|(?:main::)?bloop))"/
26 local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) };
29 eval "die qq{ok\\n}; $_";
31 is($@, "ok\n", "use indirect: $_");
34 eval "die qq{the code compiled but it shouldn't have\n}; $_";
36 like($@, expect('Hlagh'), "no indirect: $_");
40 eval "die qq{ok\\n}; $_";
42 is($@, "ok\n", "use indirect, defined: $_");
45 eval "die qq{the code compiled but it shouldn't have\n}; $_";
47 like($@, expect('Dongs'), "no indirect, defined: $_");
52 eval "die qq{ok\\n}; $_";
54 is($@, "ok\n", "use indirect, spaces: $_");
57 eval "die qq{the code compiled but it shouldn't have\n}; $_";
59 like($@, expect('Hlagh'), "no indirect, spaces: $_");
66 local $SIG{__WARN__} = sub { $warn = join ' ', @_ };
67 eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh1;";
68 like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh1"/, 'no indirect "hlagh" enables the pragma');
69 eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh2;";
70 like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh2"/, 'no indirect "hlagh" doesn\'t croak');
80 $obj = new Hlagh(1, 2);
84 $obj = new Hlagh ( ) ;
86 $obj = new Hlagh ( 1 ) ;
88 $obj = new Hlagh ( 1 , 2 ) ;
113 $obj = new $x('foo');
115 $obj = new $x qq{foo}, 1;
117 $obj = new $x qr{foo\s+bar}, 1 .. 1;
119 $obj = new $x(qw/bar baz/);
127 $obj = new $_ qr/foo/ ;
129 $obj = new $_ qq(bar baz);
149 meh $sploosh::sploosh;
164 meh $sploosh::sploosh;
170 new Hlagh->wut, "Wut";
172 $obj = HlaghHlagh Hlagh;
174 $obj = HlaghHlagh Hlagh; # HlaghHlagh Hlagh
178 $obj = new newnew; # new newnew