12 use Test::More tests => 50 * 6 + 2;
19 return qr/^warn:Indirect call of method "(?:new|meh|$pkg$pkg)" on object "(?:$pkg|newnew|\$(?:[xyz_\$]|(?:sploosh::)?sploosh|(?:main::)?bloop))"/
28 my ($skip, $prefix) = split /#+/, $1;
29 $skip = 0 unless defined $skip;
30 $prefix = '' unless defined $prefix;
35 skip "$_: $skip" => 6 if eval $skip;
37 local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) };
39 eval "die qq{ok\\n}; $prefix; use indirect; $_";
40 is($@, "ok\n", "use indirect: $_");
42 eval "die qq{the code compiled but it shouldn't have\n}; $prefix; no indirect; $_";
43 like($@, expect('Hlagh'), "no indirect: $_");
47 eval "die qq{ok\\n}; $prefix; use indirect; $_";
48 is($@, "ok\n", "use indirect, defined: $_");
50 eval "die qq{the code compiled but it shouldn't have\n}; $prefix; no indirect; $_";
51 like($@, expect('Dongs'), "no indirect, defined: $_");
56 eval "die qq{ok\\n}; $prefix; use indirect; $_";
57 is($@, "ok\n", "use indirect, spaces: $_");
59 eval "die qq{the code compiled but it shouldn't have\n}; $prefix; no indirect; $_";
60 like($@, expect('Hlagh'), "no indirect, spaces: $_");
67 local $SIG{__WARN__} = sub { $warn = join ' ', @_ };
68 eval "die qq{ok\n}; no indirect 'hlagh'; \$obj = new Hlagh1;";
69 is($@, "ok\n", 'no indirect "hlagh" didn\'t croak');
70 like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh1"/, 'no indirect "hlagh" enables the pragma');
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);
151 #### $] < 5.010 # use feature 'state'; state $z
153 #### $] < 5.010 # use feature 'state'; state $z
155 #### $] < 5.010 # use feature 'state'; state $z
160 meh $sploosh::sploosh;
178 meh $sploosh::sploosh;
184 new Hlagh->wut, "Wut";
186 $obj = HlaghHlagh Hlagh;
188 $obj = HlaghHlagh Hlagh; # HlaghHlagh Hlagh
192 $obj = new newnew; # new newnew