12 use Test::More tests => 44 * 4 + 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: $_");
54 local $SIG{__WARN__} = sub { $warn = join ' ', @_ };
55 eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh1;";
56 like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh1"/, 'no indirect "hlagh" enables the pragma');
57 eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh2;";
58 like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh2"/, 'no indirect "hlagh" doesn\'t croak');
68 $obj = new Hlagh(1, 2);
72 $obj = new Hlagh ( ) ;
74 $obj = new Hlagh ( 1 ) ;
76 $obj = new Hlagh ( 1 , 2 ) ;
101 $obj = new $x('foo');
103 $obj = new $x qq{foo}, 1;
105 $obj = new $x qr{foo\s+bar}, 1 .. 1;
107 $obj = new $x(qw/bar baz/);
115 $obj = new $_ qr/foo/ ;
117 $obj = new $_ qq(bar baz);
137 meh $sploosh::sploosh;
152 meh $sploosh::sploosh;
158 new Hlagh->wut, "Wut";
160 $obj = HlaghHlagh Hlagh;
162 $obj = HlaghHlagh Hlagh; # HlaghHlagh Hlagh
166 $obj = new newnew; # new newnew