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))"/
31 my ($skip, $prefix) = split /#+/, $1;
32 $skip = 0 unless defined $skip;
33 $prefix = '' unless defined $prefix;
38 skip "$_: $skip" => 6 if eval $skip;
40 local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) };
42 eval "die qq{ok\\n}; $prefix; use indirect; $_";
43 is($@, "ok\n", "use indirect: $_");
45 eval "die qq{the code compiled but it shouldn't have\n}; $prefix; no indirect; $_";
46 like($@, expect('Hlagh'), "no indirect: $_");
50 eval "die qq{ok\\n}; $prefix; use indirect; $_";
51 is($@, "ok\n", "use indirect, defined: $_");
53 eval "die qq{the code compiled but it shouldn't have\n}; $prefix; no indirect; $_";
54 like($@, expect('Dongs'), "no indirect, defined: $_");
59 eval "die qq{ok\\n}; $prefix; use indirect; $_";
60 is($@, "ok\n", "use indirect, spaces: $_");
62 eval "die qq{the code compiled but it shouldn't have\n}; $prefix; no indirect; $_";
63 like($@, expect('Hlagh'), "no indirect, spaces: $_");
70 local $SIG{__WARN__} = sub { $warn = join ' ', @_ };
71 eval "die qq{ok\n}; no indirect 'hlagh'; \$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');
84 $obj = new Hlagh(1, 2);
88 $obj = new Hlagh ( ) ;
90 $obj = new Hlagh ( 1 ) ;
92 $obj = new Hlagh ( 1 , 2 ) ;
117 $obj = new $x('foo');
119 $obj = new $x qq{foo}, 1;
121 $obj = new $x qr{foo\s+bar}, 1 .. 1;
123 $obj = new $x(qw/bar baz/);
131 $obj = new $_ qr/foo/ ;
133 $obj = new $_ qq(bar baz);
163 meh $sploosh::sploosh;
181 meh $sploosh::sploosh;
187 new Hlagh->wut, "Wut";
189 $obj = HlaghHlagh Hlagh;
191 $obj = HlaghHlagh Hlagh; # HlaghHlagh Hlagh
195 $obj = new newnew; # new newnew