12 use Test::More tests => 50 * 6 + 2;
19 qr/^warn:Indirect\s+call\s+of\s+method\s+
20 "(?:new|meh|$pkg$pkg)"
22 "(?:$pkg|newnew|\$(?:[xyz_\$]|(?:sploosh::)?sploosh|(?:main::)?bloop))"
23 \s+at\s+\(eval\s+\d+\)\s+line\s+\d+
33 my ($skip, $prefix) = split /#+/, $1;
34 $skip = 0 unless defined $skip;
35 $prefix = '' unless defined $prefix;
40 skip "$_: $skip" => 6 if eval $skip;
42 local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) };
44 eval "die qq{ok\\n}; $prefix; use indirect; $_";
45 is($@, "ok\n", "use indirect: $_");
47 eval "die qq{the code compiled but it shouldn't have\n}; $prefix; no indirect; $_";
48 like($@, expect('Hlagh'), "no indirect: $_");
52 eval "die qq{ok\\n}; $prefix; use indirect; $_";
53 is($@, "ok\n", "use indirect, defined: $_");
55 eval "die qq{the code compiled but it shouldn't have\n}; $prefix; no indirect; $_";
56 like($@, expect('Dongs'), "no indirect, defined: $_");
61 eval "die qq{ok\\n}; $prefix; use indirect; $_";
62 is($@, "ok\n", "use indirect, spaces: $_");
64 eval "die qq{the code compiled but it shouldn't have\n}; $prefix; no indirect; $_";
65 like($@, expect('Hlagh'), "no indirect, spaces: $_");
72 local $SIG{__WARN__} = sub { $warn = join ' ', @_ };
73 eval "die qq{ok\n}; no indirect 'hlagh'; \$obj = new Hlagh1;";
74 is($@, "ok\n", 'no indirect "hlagh" didn\'t croak');
75 like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh1"/, 'no indirect "hlagh" enables the pragma');
86 $obj = new Hlagh(1, 2);
90 $obj = new Hlagh ( ) ;
92 $obj = new Hlagh ( 1 ) ;
94 $obj = new Hlagh ( 1 , 2 ) ;
119 $obj = new $x('foo');
121 $obj = new $x qq{foo}, 1;
123 $obj = new $x qr{foo\s+bar}, 1 .. 1;
125 $obj = new $x(qw/bar baz/);
133 $obj = new $_ qr/foo/ ;
135 $obj = new $_ qq(bar baz);
156 #### $] < 5.010 # use feature 'state'; state $z
158 #### $] < 5.010 # use feature 'state'; state $z
160 #### $] < 5.010 # use feature 'state'; state $z
165 meh $sploosh::sploosh;
183 meh $sploosh::sploosh;
189 new Hlagh->wut, "Wut";
191 $obj = HlaghHlagh Hlagh;
193 $obj = HlaghHlagh Hlagh; # HlaghHlagh Hlagh
197 $obj = new newnew; # new newnew