xref: /openbsd/gnu/usr.bin/perl/t/lib/croak/pp_ctl (revision f2a19305)
1898184e3Ssthen__END__
25759b3d2Safresh1# NAME goto into foreach
35759b3d2Safresh1no warnings 'deprecated';
45759b3d2Safresh1goto f;
55759b3d2Safresh1foreach(1){f:}
65759b3d2Safresh1EXPECT
75759b3d2Safresh1Can't "goto" into the middle of a foreach loop at - line 3.
85759b3d2Safresh1########
95759b3d2Safresh1# NAME goto into given
105759b3d2Safresh1no warnings 'deprecated';
115759b3d2Safresh1goto f;
125759b3d2Safresh1CORE::given(1){f:}
135759b3d2Safresh1EXPECT
145759b3d2Safresh1Can't "goto" into a "given" block at - line 3.
155759b3d2Safresh1########
165759b3d2Safresh1# NAME goto from given topic expression
175759b3d2Safresh1no warnings 'deprecated';
185759b3d2Safresh1CORE::given(goto f){f:}
195759b3d2Safresh1EXPECT
205759b3d2Safresh1Can't "goto" into a "given" block at - line 2.
215759b3d2Safresh1########
225759b3d2Safresh1# NAME goto into expression
235759b3d2Safresh1no warnings 'deprecated';
245759b3d2Safresh1eval { goto a; 1 + do { a: } }; warn $@;
255759b3d2Safresh1eval { goto b; meth { b: }   }; warn $@;
265759b3d2Safresh1eval { goto c; map { c: } () }; warn $@;
275759b3d2Safresh1eval { goto d; f(do { d: })  }; die  $@;
285759b3d2Safresh1EXPECT
295759b3d2Safresh1Can't "goto" into a binary or list expression at - line 2.
305759b3d2Safresh1Can't "goto" into a binary or list expression at - line 3.
315759b3d2Safresh1Can't "goto" into a binary or list expression at - line 4.
325759b3d2Safresh1Can't "goto" into a binary or list expression at - line 5.
335759b3d2Safresh1########
3491f110e0Safresh1# NAME dump with computed label
355759b3d2Safresh1no warnings 'deprecated';
3691f110e0Safresh1my $label = "foo";
37f3efcd01Safresh1CORE::dump $label;
3891f110e0Safresh1EXPECT
395759b3d2Safresh1Can't find label foo at - line 3.
4091f110e0Safresh1########
41898184e3Ssthen# NAME when outside given
42*f2a19305Safresh1use 5.01; no warnings 'deprecated';
43898184e3Ssthenwhen(undef){}
44898184e3SsthenEXPECT
45898184e3SsthenCan't "when" outside a topicalizer at - line 2.
46898184e3Ssthen########
47898184e3Ssthen# NAME default outside given
48898184e3Ssthenuse 5.01;
49898184e3Ssthendefault{}
50898184e3SsthenEXPECT
51898184e3SsthenCan't "default" outside a topicalizer at - line 2.
52de8cc8edSafresh1########
53de8cc8edSafresh1# NAME croak with read only $@
54de8cc8edSafresh1eval '"a" =~ /${*@=\_})/';
55de8cc8edSafresh1die;
56de8cc8edSafresh1# this would previously recurse infinitely in the eval
57de8cc8edSafresh1EXPECT
58de8cc8edSafresh1Unmatched ) in regex; marked by <-- HERE in m/_) <-- HERE / at (eval 1) line 1.
59de8cc8edSafresh1	...propagated at - line 2.
60