10 eval "#line 8 foo\nsub t004 :method (\$a) { }";
11 is $@, "Experimental subroutine signatures not enabled at foo line 8\.\n",
12 "error when not enabled";
14 eval "#line 8 foo\nsub t005 (\$) (\$a) { }";
15 is $@, "Experimental subroutine signatures not enabled at foo line 8\.\n",
16 "error when not enabled";
18 no warnings "illegalproto";
23 sub t000 ($a) { $a || "z" }
24 is prototype(\&t000), "\$a", "(\$a) interpreted as protoype when not enabled";
25 is &t000(456), 123, "(\$a) not signature when not enabled";
28 no warnings "experimental::signatures";
29 use feature "signatures";
31 sub t001 { $a || "z" }
32 is prototype(\&t001), undef;
33 is eval("t001()"), 123;
34 is eval("t001(456)"), 123;
35 is eval("t001(456, 789)"), 123;
38 sub t002 () { $a || "z" }
39 is prototype(\&t002), undef;
40 is eval("t002()"), 123;
41 is eval("t002(456)"), undef;
42 like $@, qr/\AToo many arguments for subroutine at/;
43 is eval("t002(456, 789)"), undef;
44 like $@, qr/\AToo many arguments for subroutine at/;
47 sub t003 ( ) { $a || "z" }
48 is prototype(\&t003), undef;
49 is eval("t003()"), 123;
50 is eval("t003(456)"), undef;
51 like $@, qr/\AToo many arguments for subroutine at/;
52 is eval("t003(456, 789)"), undef;
53 like $@, qr/\AToo many arguments for subroutine at/;
56 sub t006 ($a) { $a || "z" }
57 is prototype(\&t006), undef;
58 is eval("t006()"), undef;
59 like $@, qr/\AToo few arguments for subroutine at/;
60 is eval("t006(0)"), "z";
61 is eval("t006(456)"), 456;
62 is eval("t006(456, 789)"), undef;
63 like $@, qr/\AToo many arguments for subroutine at/;
64 is eval("t006(456, 789, 987)"), undef;
65 like $@, qr/\AToo many arguments for subroutine at/;
68 sub t007 ($a, $b) { $a.$b }
69 is prototype(\&t007), undef;
70 is eval("t007()"), undef;
71 like $@, qr/\AToo few arguments for subroutine at/;
72 is eval("t007(456)"), undef;
73 like $@, qr/\AToo few arguments for subroutine at/;
74 is eval("t007(456, 789)"), "456789";
75 is eval("t007(456, 789, 987)"), undef;
76 like $@, qr/\AToo many arguments for subroutine at/;
77 is eval("t007(456, 789, 987, 654)"), undef;
78 like $@, qr/\AToo many arguments for subroutine at/;
81 sub t008 ($a, $b, $c) { $a.$b.$c }
82 is prototype(\&t008), undef;
83 is eval("t008()"), undef;
84 like $@, qr/\AToo few arguments for subroutine at/;
85 is eval("t008(456)"), undef;
86 like $@, qr/\AToo few arguments for subroutine at/;
87 is eval("t008(456, 789)"), undef;
88 like $@, qr/\AToo few arguments for subroutine at/;
89 is eval("t008(456, 789, 987)"), "456789987";
90 is eval("t008(456, 789, 987, 654)"), undef;
91 like $@, qr/\AToo many arguments for subroutine at/;
94 sub t009 ($abc, $def) { $abc.$def }
95 is prototype(\&t009), undef;
96 is eval("t009()"), undef;
97 like $@, qr/\AToo few arguments for subroutine at/;
98 is eval("t009(456)"), undef;
99 like $@, qr/\AToo few arguments for subroutine at/;
100 is eval("t009(456, 789)"), "456789";
101 is eval("t009(456, 789, 987)"), undef;
102 like $@, qr/\AToo many arguments for subroutine at/;
103 is eval("t009(456, 789, 987, 654)"), undef;
104 like $@, qr/\AToo many arguments for subroutine at/;
107 sub t010 ($a, $) { $a || "z" }
108 is prototype(\&t010), undef;
109 is eval("t010()"), undef;
110 like $@, qr/\AToo few arguments for subroutine at/;
111 is eval("t010(456)"), undef;
112 like $@, qr/\AToo few arguments for subroutine at/;
113 is eval("t010(0, 789)"), "z";
114 is eval("t010(456, 789)"), 456;
115 is eval("t010(456, 789, 987)"), undef;
116 like $@, qr/\AToo many arguments for subroutine at/;
117 is eval("t010(456, 789, 987, 654)"), undef;
118 like $@, qr/\AToo many arguments for subroutine at/;
121 sub t011 ($, $a) { $a || "z" }
122 is prototype(\&t011), undef;
123 is eval("t011()"), undef;
124 like $@, qr/\AToo few arguments for subroutine at/;
125 is eval("t011(456)"), undef;
126 like $@, qr/\AToo few arguments for subroutine at/;
127 is eval("t011(456, 0)"), "z";
128 is eval("t011(456, 789)"), 789;
129 is eval("t011(456, 789, 987)"), undef;
130 like $@, qr/\AToo many arguments for subroutine at/;
131 is eval("t011(456, 789, 987, 654)"), undef;
132 like $@, qr/\AToo many arguments for subroutine at/;
135 sub t012 ($, $) { $a || "z" }
136 is prototype(\&t012), undef;
137 is eval("t012()"), undef;
138 like $@, qr/\AToo few arguments for subroutine at/;
139 is eval("t012(456)"), undef;
140 like $@, qr/\AToo few arguments for subroutine at/;
141 is eval("t012(0, 789)"), 123;
142 is eval("t012(456, 789)"), 123;
143 is eval("t012(456, 789, 987)"), undef;
144 like $@, qr/\AToo many arguments for subroutine at/;
145 is eval("t012(456, 789, 987, 654)"), undef;
146 like $@, qr/\AToo many arguments for subroutine at/;
149 sub t013 ($) { $a || "z" }
150 is prototype(\&t013), undef;
151 is eval("t013()"), undef;
152 like $@, qr/\AToo few arguments for subroutine at/;
153 is eval("t013(0)"), 123;
154 is eval("t013(456)"), 123;
155 is eval("t013(456, 789)"), undef;
156 like $@, qr/\AToo many arguments for subroutine at/;
157 is eval("t013(456, 789, 987)"), undef;
158 like $@, qr/\AToo many arguments for subroutine at/;
159 is eval("t013(456, 789, 987, 654)"), undef;
160 like $@, qr/\AToo many arguments for subroutine at/;
163 sub t014 ($a = 222) { $a // "z" }
164 is prototype(\&t014), undef;
165 is eval("t014()"), 222;
166 is eval("t014(0)"), 0;
167 is eval("t014(undef)"), "z";
168 is eval("t014(456)"), 456;
169 is eval("t014(456, 789)"), undef;
170 like $@, qr/\AToo many arguments for subroutine at/;
171 is eval("t014(456, 789, 987)"), undef;
172 like $@, qr/\AToo many arguments for subroutine at/;
175 sub t015 ($a = undef) { $a // "z" }
176 is prototype(\&t015), undef;
177 is eval("t015()"), "z";
178 is eval("t015(0)"), 0;
179 is eval("t015(undef)"), "z";
180 is eval("t015(456)"), 456;
181 is eval("t015(456, 789)"), undef;
182 like $@, qr/\AToo many arguments for subroutine at/;
183 is eval("t015(456, 789, 987)"), undef;
184 like $@, qr/\AToo many arguments for subroutine at/;
187 sub t016 ($a = do { $z++; 222 }) { $a // "z" }
189 is prototype(\&t016), undef;
190 is eval("t016()"), 222;
192 is eval("t016(0)"), 0;
193 is eval("t016(undef)"), "z";
194 is eval("t016(456)"), 456;
195 is eval("t016(456, 789)"), undef;
196 like $@, qr/\AToo many arguments for subroutine at/;
197 is eval("t016(456, 789, 987)"), undef;
198 like $@, qr/\AToo many arguments for subroutine at/;
200 is eval("t016()"), 222;
204 sub t018 { join("/", @_) }
205 sub t017 ($p = t018 222, $a = 333) { $p // "z" }
206 is prototype(\&t017), undef;
207 is eval("t017()"), "222/333";
210 is eval("t017(0)"), 0;
211 is eval("t017(undef)"), "z";
212 is eval("t017(456)"), 456;
213 is eval("t017(456, 789)"), undef;
214 like $@, qr/\AToo many arguments for subroutine at/;
215 is eval("t017(456, 789, 987)"), undef;
216 like $@, qr/\AToo many arguments for subroutine at/;
219 sub t019 ($p = 222, $a = 333) { "$p/$a" }
220 is prototype(\&t019), undef;
221 is eval("t019()"), "222/333";
222 is eval("t019(0)"), "0/333";
223 is eval("t019(456)"), "456/333";
224 is eval("t019(456, 789)"), "456/789";
225 is eval("t019(456, 789, 987)"), undef;
226 like $@, qr/\AToo many arguments for subroutine at/;
229 sub t020 :prototype($) { $_[0]."z" }
230 sub t021 ($p = t020 222, $a = 333) { "$p/$a" }
231 is prototype(\&t021), undef;
232 is eval("t021()"), "222z/333";
233 is eval("t021(0)"), "0/333";
234 is eval("t021(456)"), "456/333";
235 is eval("t021(456, 789)"), "456/789";
236 is eval("t021(456, 789, 987)"), undef;
237 like $@, qr/\AToo many arguments for subroutine at/;
240 sub t022 ($p = do { $z += 10; 222 }, $a = do { $z++; 333 }) { "$p/$a" }
242 is prototype(\&t022), undef;
243 is eval("t022()"), "222/333";
245 is eval("t022(0)"), "0/333";
247 is eval("t022(456)"), "456/333";
249 is eval("t022(456, 789)"), "456/789";
250 is eval("t022(456, 789, 987)"), undef;
251 like $@, qr/\AToo many arguments for subroutine at/;
255 sub t023 ($a = sub { $_[0]."z" }) { $a->("a")."y" }
256 is prototype(\&t023), undef;
257 is eval("t023()"), "azy";
258 is eval("t023(sub { \"x\".\$_[0].\"x\" })"), "xaxy";
259 is eval("t023(sub { \"x\".\$_[0].\"x\" }, 789)"), undef;
260 like $@, qr/\AToo many arguments for subroutine at/;
263 sub t036 ($a = $a."x") { $a."y" }
264 is prototype(\&t036), undef;
265 is eval("t036()"), "123xy";
266 is eval("t036(0)"), "0y";
267 is eval("t036(456)"), "456y";
268 is eval("t036(456, 789)"), undef;
269 like $@, qr/\AToo many arguments for subroutine at/;
272 sub t120 ($a = $_) { $a // "z" }
273 is prototype(\&t120), undef;
275 is eval("t120()"), "___";
277 is eval("t120(undef)"), "z";
279 is eval("t120(0)"), 0;
281 is eval("t120(456)"), 456;
283 is eval("t120(456, 789)"), undef;
284 like $@, qr/\AToo many arguments for subroutine at/;
287 sub t121 ($a = caller) { $a // "z" }
288 is prototype(\&t121), undef;
289 is eval("t121()"), "main";
290 is eval("t121(undef)"), "z";
291 is eval("t121(0)"), 0;
292 is eval("t121(456)"), 456;
293 is eval("t121(456, 789)"), undef;
294 like $@, qr/\AToo many arguments for subroutine at/;
295 is eval("package T121::Z; ::t121()"), "T121::Z";
296 is eval("package T121::Z; ::t121(undef)"), "z";
297 is eval("package T121::Z; ::t121(0)"), 0;
298 is eval("package T121::Z; ::t121(456)"), 456;
299 is eval("package T121::Z; ::t121(456, 789)"), undef;
300 like $@, qr/\AToo many arguments for subroutine at/;
303 sub t129 ($a = return 222) { $a."x" }
304 is prototype(\&t129), undef;
305 is eval("t129()"), "222";
306 is eval("t129(0)"), "0x";
307 is eval("t129(456)"), "456x";
308 is eval("t129(456, 789)"), undef;
309 like $@, qr/\AToo many arguments for subroutine at/;
312 use feature "current_sub";
313 sub t122 ($c = 5, $r = $c > 0 ? __SUB__->($c - 1) : "") { $c.$r }
314 is prototype(\&t122), undef;
315 is eval("t122()"), "543210";
316 is eval("t122(0)"), "0";
317 is eval("t122(1)"), "10";
318 is eval("t122(5)"), "543210";
319 is eval("t122(5, 789)"), "5789";
320 is eval("t122(5, 789, 987)"), undef;
321 like $@, qr/\AToo many arguments for subroutine at/;
324 sub t123 ($list = wantarray) { $list ? "list" : "scalar" }
325 is prototype(\&t123), undef;
326 is eval("scalar(t123())"), "scalar";
327 is eval("(t123())[0]"), "list";
328 is eval("scalar(t123(0))"), "scalar";
329 is eval("(t123(0))[0]"), "scalar";
330 is eval("scalar(t123(1))"), "list";
331 is eval("(t123(1))[0]"), "list";
332 is eval("t123(456, 789)"), undef;
333 like $@, qr/\AToo many arguments for subroutine at/;
336 sub t124 ($b = (local $a = $a + 1)) { "$a/$b" }
337 is prototype(\&t124), undef;
338 is eval("t124()"), "124/124";
340 is eval("t124(456)"), "123/456";
342 is eval("t124(456, 789)"), undef;
343 like $@, qr/\AToo many arguments for subroutine at/;
346 sub t125 ($c = (our $t125_counter)++) { $c }
347 is prototype(\&t125), undef;
348 is eval("t125()"), 0;
349 is eval("t125()"), 1;
350 is eval("t125()"), 2;
351 is eval("t125(456)"), 456;
352 is eval("t125(789)"), 789;
353 is eval("t125()"), 3;
354 is eval("t125()"), 4;
355 is eval("t125(456, 789)"), undef;
356 like $@, qr/\AToo many arguments for subroutine at/;
360 sub t126 ($c = (state $s = $z++)) { $c }
361 is prototype(\&t126), undef;
363 is eval("t126(456)"), 456;
365 is eval("t126()"), 222;
367 is eval("t126(456)"), 456;
369 is eval("t126()"), 222;
371 is eval("t126(456, 789)"), undef;
372 like $@, qr/\AToo many arguments for subroutine at/;
376 sub t127 ($c = do { state $s = $z++; $s++ }) { $c }
377 is prototype(\&t127), undef;
379 is eval("t127(456)"), 456;
381 is eval("t127()"), 222;
383 is eval("t127()"), 223;
384 is eval("t127()"), 224;
386 is eval("t127(456)"), 456;
387 is eval("t127(789)"), 789;
388 is eval("t127()"), 225;
389 is eval("t127()"), 226;
390 is eval("t127(456, 789)"), undef;
391 like $@, qr/\AToo many arguments for subroutine at/;
395 sub t037 ($a = 222, $b = $a."x") { "$a/$b" }
396 is prototype(\&t037), undef;
397 is eval("t037()"), "222/222x";
398 is eval("t037(0)"), "0/0x";
399 is eval("t037(456)"), "456/456x";
400 is eval("t037(456, 789)"), "456/789";
401 is eval("t037(456, 789, 987)"), undef;
402 like $@, qr/\AToo many arguments for subroutine at/;
405 sub t128 ($a = 222, $b = ($a = 333)) { "$a/$b" }
406 is prototype(\&t128), undef;
407 is eval("t128()"), "333/333";
408 is eval("t128(0)"), "333/333";
409 is eval("t128(456)"), "333/333";
410 is eval("t128(456, 789)"), "456/789";
411 is eval("t128(456, 789, 987)"), undef;
412 like $@, qr/\AToo many arguments for subroutine at/;
415 sub t130 { join(",", @_).";".scalar(@_) }
416 sub t131 ($a = 222, $b = goto &t130) { "$a/$b" }
417 is prototype(\&t131), undef;
418 is eval("t131()"), ";0";
419 is eval("t131(0)"), "0;1";
420 is eval("t131(456)"), "456;1";
421 is eval("t131(456, 789)"), "456/789";
422 is eval("t131(456, 789, 987)"), undef;
423 like $@, qr/\AToo many arguments for subroutine at/;
426 eval "#line 8 foo\nsub t024 (\$a =) { }";
427 is $@, "Optional parameter lacks default expression at foo line 8\.\n";
429 sub t025 ($ = undef) { $a // "z" }
430 is prototype(\&t025), undef;
431 is eval("t025()"), 123;
432 is eval("t025(0)"), 123;
433 is eval("t025(456)"), 123;
434 is eval("t025(456, 789)"), undef;
435 like $@, qr/\AToo many arguments for subroutine at/;
436 is eval("t025(456, 789, 987)"), undef;
437 like $@, qr/\AToo many arguments for subroutine at/;
438 is eval("t025(456, 789, 987, 654)"), undef;
439 like $@, qr/\AToo many arguments for subroutine at/;
442 sub t026 ($ = 222) { $a // "z" }
443 is prototype(\&t026), undef;
444 is eval("t026()"), 123;
445 is eval("t026(0)"), 123;
446 is eval("t026(456)"), 123;
447 is eval("t026(456, 789)"), undef;
448 like $@, qr/\AToo many arguments for subroutine at/;
449 is eval("t026(456, 789, 987)"), undef;
450 like $@, qr/\AToo many arguments for subroutine at/;
451 is eval("t026(456, 789, 987, 654)"), undef;
452 like $@, qr/\AToo many arguments for subroutine at/;
455 sub t032 ($ = do { $z++; 222 }) { $a // "z" }
457 is prototype(\&t032), undef;
458 is eval("t032()"), 123;
460 is eval("t032(0)"), 123;
461 is eval("t032(456)"), 123;
462 is eval("t032(456, 789)"), undef;
463 like $@, qr/\AToo many arguments for subroutine at/;
464 is eval("t032(456, 789, 987)"), undef;
465 like $@, qr/\AToo many arguments for subroutine at/;
466 is eval("t032(456, 789, 987, 654)"), undef;
467 like $@, qr/\AToo many arguments for subroutine at/;
471 sub t027 ($ =) { $a // "z" }
472 is prototype(\&t027), undef;
473 is eval("t027()"), 123;
474 is eval("t027(0)"), 123;
475 is eval("t027(456)"), 123;
476 is eval("t027(456, 789)"), undef;
477 like $@, qr/\AToo many arguments for subroutine at/;
478 is eval("t027(456, 789, 987)"), undef;
479 like $@, qr/\AToo many arguments for subroutine at/;
480 is eval("t027(456, 789, 987, 654)"), undef;
481 like $@, qr/\AToo many arguments for subroutine at/;
484 sub t119 ($ =, $a = 333) { $a // "z" }
485 is prototype(\&t119), undef;
486 is eval("t119()"), 333;
487 is eval("t119(0)"), 333;
488 is eval("t119(456)"), 333;
489 is eval("t119(456, 789)"), 789;
490 is eval("t119(456, 789, 987)"), undef;
491 like $@, qr/\AToo many arguments for subroutine at/;
492 is eval("t119(456, 789, 987, 654)"), undef;
493 like $@, qr/\AToo many arguments for subroutine at/;
496 sub t028 ($a, $b = 333) { "$a/$b" }
497 is prototype(\&t028), undef;
498 is eval("t028()"), undef;
499 like $@, qr/\AToo few arguments for subroutine at/;
500 is eval("t028(0)"), "0/333";
501 is eval("t028(456)"), "456/333";
502 is eval("t028(456, 789)"), "456/789";
503 is eval("t028(456, 789, 987)"), undef;
504 like $@, qr/\AToo many arguments for subroutine at/;
507 sub t045 ($a, $ = 333) { "$a/" }
508 is prototype(\&t045), undef;
509 is eval("t045()"), undef;
510 like $@, qr/\AToo few arguments for subroutine at/;
511 is eval("t045(0)"), "0/";
512 is eval("t045(456)"), "456/";
513 is eval("t045(456, 789)"), "456/";
514 is eval("t045(456, 789, 987)"), undef;
515 like $@, qr/\AToo many arguments for subroutine at/;
518 sub t046 ($, $b = 333) { "$a/$b" }
519 is prototype(\&t046), undef;
520 is eval("t046()"), undef;
521 like $@, qr/\AToo few arguments for subroutine at/;
522 is eval("t046(0)"), "123/333";
523 is eval("t046(456)"), "123/333";
524 is eval("t046(456, 789)"), "123/789";
525 is eval("t046(456, 789, 987)"), undef;
526 like $@, qr/\AToo many arguments for subroutine at/;
529 sub t047 ($, $ = 333) { "$a/" }
530 is prototype(\&t047), undef;
531 is eval("t047()"), undef;
532 like $@, qr/\AToo few arguments for subroutine at/;
533 is eval("t047(0)"), "123/";
534 is eval("t047(456)"), "123/";
535 is eval("t047(456, 789)"), "123/";
536 is eval("t047(456, 789, 987)"), undef;
537 like $@, qr/\AToo many arguments for subroutine at/;
540 sub t029 ($a, $b, $c = 222, $d = 333) { "$a/$b/$c/$d" }
541 is prototype(\&t029), undef;
542 is eval("t029()"), undef;
543 like $@, qr/\AToo few arguments for subroutine at/;
544 is eval("t029(0)"), undef;
545 like $@, qr/\AToo few arguments for subroutine at/;
546 is eval("t029(456)"), undef;
547 like $@, qr/\AToo few arguments for subroutine at/;
548 is eval("t029(456, 789)"), "456/789/222/333";
549 is eval("t029(456, 789, 987)"), "456/789/987/333";
550 is eval("t029(456, 789, 987, 654)"), "456/789/987/654";
551 is eval("t029(456, 789, 987, 654, 321)"), undef;
552 like $@, qr/\AToo many arguments for subroutine at/;
553 is eval("t029(456, 789, 987, 654, 321, 111)"), undef;
554 like $@, qr/\AToo many arguments for subroutine at/;
557 sub t038 ($a, $b = $a."x") { "$a/$b" }
558 is prototype(\&t038), undef;
559 is eval("t038()"), undef;
560 like $@, qr/\AToo few arguments for subroutine at/;
561 is eval("t038(0)"), "0/0x";
562 is eval("t038(456)"), "456/456x";
563 is eval("t038(456, 789)"), "456/789";
564 is eval("t038(456, 789, 987)"), undef;
565 like $@, qr/\AToo many arguments for subroutine at/;
568 eval "#line 8 foo\nsub t030 (\$a = 222, \$b) { }";
569 is $@, "Mandatory parameter follows optional parameter at foo line 8\.\n";
571 eval "#line 8 foo\nsub t031 (\$a = 222, \$b = 333, \$c, \$d) { }";
572 is $@, "Mandatory parameter follows optional parameter at foo line 8\.\n";
574 sub t034 (@abc) { join("/", @abc).";".scalar(@abc) }
575 is prototype(\&t034), undef;
576 is eval("t034()"), ";0";
577 is eval("t034(0)"), "0;1";
578 is eval("t034(456)"), "456;1";
579 is eval("t034(456, 789)"), "456/789;2";
580 is eval("t034(456, 789, 987)"), "456/789/987;3";
581 is eval("t034(456, 789, 987, 654)"), "456/789/987/654;4";
582 is eval("t034(456, 789, 987, 654, 321)"), "456/789/987/654/321;5";
583 is eval("t034(456, 789, 987, 654, 321, 111)"), "456/789/987/654/321/111;6";
586 eval "#line 8 foo\nsub t136 (\@abc = 222) { }";
587 like $@, qr/\AParse error at foo line 8\.\n/;
589 eval "#line 8 foo\nsub t137 (\@abc =) { }";
590 like $@, qr/\AParse error at foo line 8\.\n/;
593 is prototype(\&t035), undef;
594 is eval("t035()"), 123;
595 is eval("t035(0)"), 123;
596 is eval("t035(456)"), 123;
597 is eval("t035(456, 789)"), 123;
598 is eval("t035(456, 789, 987)"), 123;
599 is eval("t035(456, 789, 987, 654)"), 123;
600 is eval("t035(456, 789, 987, 654, 321)"), 123;
601 is eval("t035(456, 789, 987, 654, 321, 111)"), 123;
604 eval "#line 8 foo\nsub t138 (\@ = 222) { }";
605 like $@, qr/\AParse error at foo line 8\.\n/;
607 eval "#line 8 foo\nsub t139 (\@ =) { }";
608 like $@, qr/\AParse error at foo line 8\.\n/;
610 sub t039 (%abc) { join("/", map { $_."=".$abc{$_} } sort keys %abc) }
611 is prototype(\&t039), undef;
612 is eval("t039()"), "";
613 is eval("t039(0)"), undef;
614 like $@, qr#\AOdd name/value argument for subroutine at#;
615 is eval("t039(456)"), undef;
616 like $@, qr#\AOdd name/value argument for subroutine at#;
617 is eval("t039(456, 789)"), "456=789";
618 is eval("t039(456, 789, 987)"), undef;
619 like $@, qr#\AOdd name/value argument for subroutine at#;
620 is eval("t039(456, 789, 987, 654)"), "456=789/987=654";
621 is eval("t039(456, 789, 987, 654, 321)"), undef;
622 like $@, qr#\AOdd name/value argument for subroutine at#;
623 is eval("t039(456, 789, 987, 654, 321, 111)"), "321=111/456=789/987=654";
626 eval "#line 8 foo\nsub t140 (\%abc = 222) { }";
627 like $@, qr/\AParse error at foo line 8\.\n/;
629 eval "#line 8 foo\nsub t141 (\%abc =) { }";
630 like $@, qr/\AParse error at foo line 8\.\n/;
633 is prototype(\&t040), undef;
634 is eval("t040()"), 123;
635 is eval("t040(0)"), undef;
636 like $@, qr#\AOdd name/value argument for subroutine at#;
637 is eval("t040(456)"), undef;
638 like $@, qr#\AOdd name/value argument for subroutine at#;
639 is eval("t040(456, 789)"), 123;
640 is eval("t040(456, 789, 987)"), undef;
641 like $@, qr#\AOdd name/value argument for subroutine at#;
642 is eval("t040(456, 789, 987, 654)"), 123;
643 is eval("t040(456, 789, 987, 654, 321)"), undef;
644 like $@, qr#\AOdd name/value argument for subroutine at#;
645 is eval("t040(456, 789, 987, 654, 321, 111)"), 123;
648 eval "#line 8 foo\nsub t142 (\% = 222) { }";
649 like $@, qr/\AParse error at foo line 8\.\n/;
651 eval "#line 8 foo\nsub t143 (\% =) { }";
652 like $@, qr/\AParse error at foo line 8\.\n/;
654 sub t041 ($a, @b) { $a.";".join("/", @b) }
655 is prototype(\&t041), undef;
656 is eval("t041()"), undef;
657 like $@, qr/\AToo few arguments for subroutine at/;
658 is eval("t041(0)"), "0;";
659 is eval("t041(456)"), "456;";
660 is eval("t041(456, 789)"), "456;789";
661 is eval("t041(456, 789, 987)"), "456;789/987";
662 is eval("t041(456, 789, 987, 654)"), "456;789/987/654";
663 is eval("t041(456, 789, 987, 654, 321)"), "456;789/987/654/321";
664 is eval("t041(456, 789, 987, 654, 321, 111)"), "456;789/987/654/321/111";
667 sub t042 ($a, @) { $a.";" }
668 is prototype(\&t042), undef;
669 is eval("t042()"), undef;
670 like $@, qr/\AToo few arguments for subroutine at/;
671 is eval("t042(0)"), "0;";
672 is eval("t042(456)"), "456;";
673 is eval("t042(456, 789)"), "456;";
674 is eval("t042(456, 789, 987)"), "456;";
675 is eval("t042(456, 789, 987, 654)"), "456;";
676 is eval("t042(456, 789, 987, 654, 321)"), "456;";
677 is eval("t042(456, 789, 987, 654, 321, 111)"), "456;";
680 sub t043 ($, @b) { $a.";".join("/", @b) }
681 is prototype(\&t043), undef;
682 is eval("t043()"), undef;
683 like $@, qr/\AToo few arguments for subroutine at/;
684 is eval("t043(0)"), "123;";
685 is eval("t043(456)"), "123;";
686 is eval("t043(456, 789)"), "123;789";
687 is eval("t043(456, 789, 987)"), "123;789/987";
688 is eval("t043(456, 789, 987, 654)"), "123;789/987/654";
689 is eval("t043(456, 789, 987, 654, 321)"), "123;789/987/654/321";
690 is eval("t043(456, 789, 987, 654, 321, 111)"), "123;789/987/654/321/111";
693 sub t044 ($, @) { $a.";" }
694 is prototype(\&t044), undef;
695 is eval("t044()"), undef;
696 like $@, qr/\AToo few arguments for subroutine at/;
697 is eval("t044(0)"), "123;";
698 is eval("t044(456)"), "123;";
699 is eval("t044(456, 789)"), "123;";
700 is eval("t044(456, 789, 987)"), "123;";
701 is eval("t044(456, 789, 987, 654)"), "123;";
702 is eval("t044(456, 789, 987, 654, 321)"), "123;";
703 is eval("t044(456, 789, 987, 654, 321, 111)"), "123;";
706 sub t049 ($a, %b) { $a.";".join("/", map { $_."=".$b{$_} } sort keys %b) }
707 is prototype(\&t049), undef;
708 is eval("t049()"), undef;
709 like $@, qr/\AToo few arguments for subroutine at/;
710 is eval("t049(222)"), "222;";
711 is eval("t049(222, 456)"), undef;
712 like $@, qr#\AOdd name/value argument for subroutine at#;
713 is eval("t049(222, 456, 789)"), "222;456=789";
714 is eval("t049(222, 456, 789, 987)"), undef;
715 like $@, qr#\AOdd name/value argument for subroutine at#;
716 is eval("t049(222, 456, 789, 987, 654)"), "222;456=789/987=654";
717 is eval("t049(222, 456, 789, 987, 654, 321)"), undef;
718 like $@, qr#\AOdd name/value argument for subroutine at#;
719 is eval("t049(222, 456, 789, 987, 654, 321, 111)"),
720 "222;321=111/456=789/987=654";
723 sub t051 ($a, $b, $c, @d) { "$a;$b;$c;".join("/", @d).";".scalar(@d) }
724 is prototype(\&t051), undef;
725 is eval("t051()"), undef;
726 like $@, qr/\AToo few arguments for subroutine at/;
727 is eval("t051(456)"), undef;
728 like $@, qr/\AToo few arguments for subroutine at/;
729 is eval("t051(456, 789)"), undef;
730 like $@, qr/\AToo few arguments for subroutine at/;
731 is eval("t051(456, 789, 987)"), "456;789;987;;0";
732 is eval("t051(456, 789, 987, 654)"), "456;789;987;654;1";
733 is eval("t051(456, 789, 987, 654, 321)"), "456;789;987;654/321;2";
734 is eval("t051(456, 789, 987, 654, 321, 111)"), "456;789;987;654/321/111;3";
737 sub t052 ($a, $b, %c) { "$a;$b;".join("/", map { $_."=".$c{$_} } sort keys %c) }
738 is prototype(\&t052), undef;
739 is eval("t052()"), undef;
740 like $@, qr/\AToo few arguments for subroutine at/;
741 is eval("t052(222)"), undef;
742 like $@, qr/\AToo few arguments for subroutine at/;
743 is eval("t052(222, 333)"), "222;333;";
744 is eval("t052(222, 333, 456)"), undef;
745 like $@, qr#\AOdd name/value argument for subroutine at#;
746 is eval("t052(222, 333, 456, 789)"), "222;333;456=789";
747 is eval("t052(222, 333, 456, 789, 987)"), undef;
748 like $@, qr#\AOdd name/value argument for subroutine at#;
749 is eval("t052(222, 333, 456, 789, 987, 654)"), "222;333;456=789/987=654";
750 is eval("t052(222, 333, 456, 789, 987, 654, 321)"), undef;
751 like $@, qr#\AOdd name/value argument for subroutine at#;
752 is eval("t052(222, 333, 456, 789, 987, 654, 321, 111)"),
753 "222;333;321=111/456=789/987=654";
756 sub t053 ($a, $b, $c, %d) {
757 "$a;$b;$c;".join("/", map { $_."=".$d{$_} } sort keys %d)
759 is prototype(\&t053), undef;
760 is eval("t053()"), undef;
761 like $@, qr/\AToo few arguments for subroutine at/;
762 is eval("t053(222)"), undef;
763 like $@, qr/\AToo few arguments for subroutine at/;
764 is eval("t053(222, 333)"), undef;
765 like $@, qr/\AToo few arguments for subroutine at/;
766 is eval("t053(222, 333, 444)"), "222;333;444;";
767 is eval("t053(222, 333, 444, 456)"), undef;
768 like $@, qr#\AOdd name/value argument for subroutine at#;
769 is eval("t053(222, 333, 444, 456, 789)"), "222;333;444;456=789";
770 is eval("t053(222, 333, 444, 456, 789, 987)"), undef;
771 like $@, qr#\AOdd name/value argument for subroutine at#;
772 is eval("t053(222, 333, 444, 456, 789, 987, 654)"),
773 "222;333;444;456=789/987=654";
774 is eval("t053(222, 333, 444, 456, 789, 987, 654, 321)"), undef;
775 like $@, qr#\AOdd name/value argument for subroutine at#;
776 is eval("t053(222, 333, 444, 456, 789, 987, 654, 321, 111)"),
777 "222;333;444;321=111/456=789/987=654";
780 sub t048 ($a = 222, @b) { $a.";".join("/", @b).";".scalar(@b) }
781 is prototype(\&t048), undef;
782 is eval("t048()"), "222;;0";
783 is eval("t048(0)"), "0;;0";
784 is eval("t048(456)"), "456;;0";
785 is eval("t048(456, 789)"), "456;789;1";
786 is eval("t048(456, 789, 987)"), "456;789/987;2";
787 is eval("t048(456, 789, 987, 654)"), "456;789/987/654;3";
788 is eval("t048(456, 789, 987, 654, 321)"), "456;789/987/654/321;4";
789 is eval("t048(456, 789, 987, 654, 321, 111)"), "456;789/987/654/321/111;5";
792 sub t054 ($a = 222, $b = 333, @c) { "$a;$b;".join("/", @c).";".scalar(@c) }
793 is prototype(\&t054), undef;
794 is eval("t054()"), "222;333;;0";
795 is eval("t054(456)"), "456;333;;0";
796 is eval("t054(456, 789)"), "456;789;;0";
797 is eval("t054(456, 789, 987)"), "456;789;987;1";
798 is eval("t054(456, 789, 987, 654)"), "456;789;987/654;2";
799 is eval("t054(456, 789, 987, 654, 321)"), "456;789;987/654/321;3";
800 is eval("t054(456, 789, 987, 654, 321, 111)"), "456;789;987/654/321/111;4";
803 sub t055 ($a = 222, $b = 333, $c = 444, @d) {
804 "$a;$b;$c;".join("/", @d).";".scalar(@d)
806 is prototype(\&t055), undef;
807 is eval("t055()"), "222;333;444;;0";
808 is eval("t055(456)"), "456;333;444;;0";
809 is eval("t055(456, 789)"), "456;789;444;;0";
810 is eval("t055(456, 789, 987)"), "456;789;987;;0";
811 is eval("t055(456, 789, 987, 654)"), "456;789;987;654;1";
812 is eval("t055(456, 789, 987, 654, 321)"), "456;789;987;654/321;2";
813 is eval("t055(456, 789, 987, 654, 321, 111)"), "456;789;987;654/321/111;3";
816 sub t050 ($a = 211, %b) { $a.";".join("/", map { $_."=".$b{$_} } sort keys %b) }
817 is prototype(\&t050), undef;
818 is eval("t050()"), "211;";
819 is eval("t050(222)"), "222;";
820 is eval("t050(222, 456)"), undef;
821 like $@, qr#\AOdd name/value argument for subroutine at#;
822 is eval("t050(222, 456, 789)"), "222;456=789";
823 is eval("t050(222, 456, 789, 987)"), undef;
824 like $@, qr#\AOdd name/value argument for subroutine at#;
825 is eval("t050(222, 456, 789, 987, 654)"), "222;456=789/987=654";
826 is eval("t050(222, 456, 789, 987, 654, 321)"), undef;
827 like $@, qr#\AOdd name/value argument for subroutine at#;
828 is eval("t050(222, 456, 789, 987, 654, 321, 111)"),
829 "222;321=111/456=789/987=654";
832 sub t056 ($a = 211, $b = 311, %c) {
833 "$a;$b;".join("/", map { $_."=".$c{$_} } sort keys %c)
835 is prototype(\&t056), undef;
836 is eval("t056()"), "211;311;";
837 is eval("t056(222)"), "222;311;";
838 is eval("t056(222, 333)"), "222;333;";
839 is eval("t056(222, 333, 456)"), undef;
840 like $@, qr#\AOdd name/value argument for subroutine at#;
841 is eval("t056(222, 333, 456, 789)"), "222;333;456=789";
842 is eval("t056(222, 333, 456, 789, 987)"), undef;
843 like $@, qr#\AOdd name/value argument for subroutine at#;
844 is eval("t056(222, 333, 456, 789, 987, 654)"), "222;333;456=789/987=654";
845 is eval("t056(222, 333, 456, 789, 987, 654, 321)"), undef;
846 like $@, qr#\AOdd name/value argument for subroutine at#;
847 is eval("t056(222, 333, 456, 789, 987, 654, 321, 111)"),
848 "222;333;321=111/456=789/987=654";
851 sub t057 ($a = 211, $b = 311, $c = 411, %d) {
852 "$a;$b;$c;".join("/", map { $_."=".$d{$_} } sort keys %d)
854 is prototype(\&t057), undef;
855 is eval("t057()"), "211;311;411;";
856 is eval("t057(222)"), "222;311;411;";
857 is eval("t057(222, 333)"), "222;333;411;";
858 is eval("t057(222, 333, 444)"), "222;333;444;";
859 is eval("t057(222, 333, 444, 456)"), undef;
860 like $@, qr#\AOdd name/value argument for subroutine at#;
861 is eval("t057(222, 333, 444, 456, 789)"), "222;333;444;456=789";
862 is eval("t057(222, 333, 444, 456, 789, 987)"), undef;
863 like $@, qr#\AOdd name/value argument for subroutine at#;
864 is eval("t057(222, 333, 444, 456, 789, 987, 654)"),
865 "222;333;444;456=789/987=654";
866 is eval("t057(222, 333, 444, 456, 789, 987, 654, 321)"), undef;
867 like $@, qr#\AOdd name/value argument for subroutine at#;
868 is eval("t057(222, 333, 444, 456, 789, 987, 654, 321, 111)"),
869 "222;333;444;321=111/456=789/987=654";
872 sub t058 ($a, $b = 333, @c) { "$a;$b;".join("/", @c).";".scalar(@c) }
873 is prototype(\&t058), undef;
874 is eval("t058()"), undef;
875 like $@, qr/\AToo few arguments for subroutine at/;
876 is eval("t058(456)"), "456;333;;0";
877 is eval("t058(456, 789)"), "456;789;;0";
878 is eval("t058(456, 789, 987)"), "456;789;987;1";
879 is eval("t058(456, 789, 987, 654)"), "456;789;987/654;2";
880 is eval("t058(456, 789, 987, 654, 321)"), "456;789;987/654/321;3";
881 is eval("t058(456, 789, 987, 654, 321, 111)"), "456;789;987/654/321/111;4";
884 eval "#line 8 foo\nsub t059 (\@a, \$b) { }";
885 is $@, "Slurpy parameter not last at foo line 8\.\n";
887 eval "#line 8 foo\nsub t060 (\@a, \$b = 222) { }";
888 is $@, "Slurpy parameter not last at foo line 8\.\n";
890 eval "#line 8 foo\nsub t061 (\@a, \@b) { }";
891 is $@, "Slurpy parameter not last at foo line 8\.\n";
893 eval "#line 8 foo\nsub t062 (\@a, \%b) { }";
894 is $@, "Slurpy parameter not last at foo line 8\.\n";
896 eval "#line 8 foo\nsub t063 (\@, \$b) { }";
897 is $@, "Slurpy parameter not last at foo line 8\.\n";
899 eval "#line 8 foo\nsub t064 (\@, \$b = 222) { }";
900 is $@, "Slurpy parameter not last at foo line 8\.\n";
902 eval "#line 8 foo\nsub t065 (\@, \@b) { }";
903 is $@, "Slurpy parameter not last at foo line 8\.\n";
905 eval "#line 8 foo\nsub t066 (\@, \%b) { }";
906 is $@, "Slurpy parameter not last at foo line 8\.\n";
908 eval "#line 8 foo\nsub t067 (\@a, \$) { }";
909 is $@, "Slurpy parameter not last at foo line 8\.\n";
911 eval "#line 8 foo\nsub t068 (\@a, \$ = 222) { }";
912 is $@, "Slurpy parameter not last at foo line 8\.\n";
914 eval "#line 8 foo\nsub t069 (\@a, \@) { }";
915 is $@, "Slurpy parameter not last at foo line 8\.\n";
917 eval "#line 8 foo\nsub t070 (\@a, \%) { }";
918 is $@, "Slurpy parameter not last at foo line 8\.\n";
920 eval "#line 8 foo\nsub t071 (\@, \$) { }";
921 is $@, "Slurpy parameter not last at foo line 8\.\n";
923 eval "#line 8 foo\nsub t072 (\@, \$ = 222) { }";
924 is $@, "Slurpy parameter not last at foo line 8\.\n";
926 eval "#line 8 foo\nsub t073 (\@, \@) { }";
927 is $@, "Slurpy parameter not last at foo line 8\.\n";
929 eval "#line 8 foo\nsub t074 (\@, \%) { }";
930 is $@, "Slurpy parameter not last at foo line 8\.\n";
932 eval "#line 8 foo\nsub t075 (\%a, \$b) { }";
933 is $@, "Slurpy parameter not last at foo line 8\.\n";
935 eval "#line 8 foo\nsub t076 (\%, \$b) { }";
936 is $@, "Slurpy parameter not last at foo line 8\.\n";
938 eval "#line 8 foo\nsub t077 (\$a, \@b, \$c) { }";
939 is $@, "Slurpy parameter not last at foo line 8\.\n";
941 eval "#line 8 foo\nsub t078 (\$a, \%b, \$c) { }";
942 is $@, "Slurpy parameter not last at foo line 8\.\n";
944 eval "#line 8 foo\nsub t079 (\$a, \@b, \$c, \$d) { }";
945 is $@, "Slurpy parameter not last at foo line 8\.\n";
947 sub t080 ($a,,, $b) { $a.$b }
948 is prototype(\&t080), undef;
949 is eval("t080()"), undef;
950 like $@, qr/\AToo few arguments for subroutine at/;
951 is eval("t080(456)"), undef;
952 like $@, qr/\AToo few arguments for subroutine at/;
953 is eval("t080(456, 789)"), "456789";
954 is eval("t080(456, 789, 987)"), undef;
955 like $@, qr/\AToo many arguments for subroutine at/;
956 is eval("t080(456, 789, 987, 654)"), undef;
957 like $@, qr/\AToo many arguments for subroutine at/;
960 sub t081 ($a, $b,,) { $a.$b }
961 is prototype(\&t081), undef;
962 is eval("t081()"), undef;
963 like $@, qr/\AToo few arguments for subroutine at/;
964 is eval("t081(456)"), undef;
965 like $@, qr/\AToo few arguments for subroutine at/;
966 is eval("t081(456, 789)"), "456789";
967 is eval("t081(456, 789, 987)"), undef;
968 like $@, qr/\AToo many arguments for subroutine at/;
969 is eval("t081(456, 789, 987, 654)"), undef;
970 like $@, qr/\AToo many arguments for subroutine at/;
973 eval "#line 8 foo\nsub t082 (, \$a) { }";
974 like $@, qr/\AParse error at foo line 8\.\n/;
976 eval "#line 8 foo\nsub t083 (,) { }";
977 like $@, qr/\AParse error at foo line 8\.\n/;
979 sub t084($a,$b){ $a.$b }
980 is prototype(\&t084), undef;
981 is eval("t084()"), undef;
982 like $@, qr/\AToo few arguments for subroutine at/;
983 is eval("t084(456)"), undef;
984 like $@, qr/\AToo few arguments for subroutine at/;
985 is eval("t084(456, 789)"), "456789";
986 is eval("t084(456, 789, 987)"), undef;
987 like $@, qr/\AToo many arguments for subroutine at/;
988 is eval("t084(456, 789, 987, 654)"), undef;
989 like $@, qr/\AToo many arguments for subroutine at/;
1006 is prototype(\&t085), undef;
1007 is eval("t085()"), undef;
1008 like $@, qr/\AToo few arguments for subroutine at/;
1009 is eval("t085(456)"), "456333";
1010 is eval("t085(456, 789)"), "456789";
1011 is eval("t085(456, 789, 987)"), undef;
1012 like $@, qr/\AToo many arguments for subroutine at/;
1013 is eval("t085(456, 789, 987, 654)"), undef;
1014 like $@, qr/\AToo many arguments for subroutine at/;
1031 is prototype(\&t086), undef;
1032 is eval("t086()"), undef;
1033 like $@, qr/\AToo few arguments for subroutine at/;
1034 is eval("t086(456)"), "456333";
1035 is eval("t086(456, 789)"), "456789";
1036 is eval("t086(456, 789, 987)"), undef;
1037 like $@, qr/\AToo many arguments for subroutine at/;
1038 is eval("t086(456, 789, 987, 654)"), undef;
1039 like $@, qr/\AToo many arguments for subroutine at/;
1056 is prototype(\&t087), undef;
1057 is eval("t087()"), undef;
1058 like $@, qr/\AToo few arguments for subroutine at/;
1059 is eval("t087(456)"), "456333";
1060 is eval("t087(456, 789)"), "456789";
1061 is eval("t087(456, 789, 987)"), undef;
1062 like $@, qr/\AToo many arguments for subroutine at/;
1063 is eval("t087(456, 789, 987, 654)"), undef;
1064 like $@, qr/\AToo many arguments for subroutine at/;
1067 eval "#line 8 foo\nsub t088 (\$ #foo\na) { }";
1070 eval "#line 8 foo\nsub t089 (\$#foo\na) { }";
1071 like $@, qr/\AParse error at foo line 8\.\n/;
1073 eval "#line 8 foo\nsub t090 (\@ #foo\na) { }";
1076 eval "#line 8 foo\nsub t091 (\@#foo\na) { }";
1077 like $@, qr/\AParse error at foo line 8\.\n/;
1079 eval "#line 8 foo\nsub t092 (\% #foo\na) { }";
1082 eval "#line 8 foo\nsub t093 (\%#foo\na) { }";
1083 like $@, qr/\AParse error at foo line 8\.\n/;
1085 eval "#line 8 foo\nsub t094 (123) { }";
1086 like $@, qr/\AParse error at foo line 8\.\n/;
1088 eval "#line 8 foo\nsub t095 (\$a, 123) { }";
1089 like $@, qr/\AParse error at foo line 8\.\n/;
1091 eval "#line 8 foo\nsub t096 (\$a 123) { }";
1092 like $@, qr/\AParse error at foo line 8\.\n/;
1094 eval "#line 8 foo\nsub t097 (\$a { }) { }";
1095 like $@, qr/\AParse error at foo line 8\.\n/;
1097 eval "#line 8 foo\nsub t098 (\$a; \$b) { }";
1098 like $@, qr/\AParse error at foo line 8\.\n/;
1100 eval "#line 8 foo\nsub t099 (\$\$) { }";
1101 like $@, qr/\AParse error at foo line 8\.\n/;
1103 no warnings "experimental::lexical_topic";
1104 sub t100 ($_) { "$::_/$_" }
1105 is prototype(\&t100), undef;
1107 is eval("t100()"), undef;
1108 like $@, qr/\AToo few arguments for subroutine at/;
1110 is eval("t100(0)"), "___/0";
1112 is eval("t100(456)"), "___/456";
1114 is eval("t100(456, 789)"), undef;
1115 like $@, qr/\AToo many arguments for subroutine at/;
1117 is eval("t100(456, 789, 987)"), undef;
1118 like $@, qr/\AToo many arguments for subroutine at/;
1121 eval "#line 8 foo\nsub t101 (\@_) { }";
1122 like $@, qr/\ACan't use global \@_ in "my" at foo line 8/;
1124 eval "#line 8 foo\nsub t102 (\%_) { }";
1125 like $@, qr/\ACan't use global \%_ in "my" at foo line 8/;
1127 my $t103 = sub ($a) { $a || "z" };
1128 is prototype($t103), undef;
1129 is eval("\$t103->()"), undef;
1130 like $@, qr/\AToo few arguments for subroutine at/;
1131 is eval("\$t103->(0)"), "z";
1132 is eval("\$t103->(456)"), 456;
1133 is eval("\$t103->(456, 789)"), undef;
1134 like $@, qr/\AToo many arguments for subroutine at/;
1135 is eval("\$t103->(456, 789, 987)"), undef;
1136 like $@, qr/\AToo many arguments for subroutine at/;
1139 my $t118 = sub :prototype($) ($a) { $a || "z" };
1140 is prototype($t118), "\$";
1141 is eval("\$t118->()"), undef;
1142 like $@, qr/\AToo few arguments for subroutine at/;
1143 is eval("\$t118->(0)"), "z";
1144 is eval("\$t118->(456)"), 456;
1145 is eval("\$t118->(456, 789)"), undef;
1146 like $@, qr/\AToo many arguments for subroutine at/;
1147 is eval("\$t118->(456, 789, 987)"), undef;
1148 like $@, qr/\AToo many arguments for subroutine at/;
1151 sub t033 ($a = sub ($a) { $a."z" }) { $a->("a")."y" }
1152 is prototype(\&t033), undef;
1153 is eval("t033()"), "azy";
1154 is eval("t033(sub { \"x\".\$_[0].\"x\" })"), "xaxy";
1155 is eval("t033(sub { \"x\".\$_[0].\"x\" }, 789)"), undef;
1156 like $@, qr/\AToo many arguments for subroutine at/;
1159 sub t133 ($a = sub ($a = 222) { $a."z" }) { $a->()."/".$a->("a") }
1160 is prototype(\&t133), undef;
1161 is eval("t133()"), "222z/az";
1162 is eval("t133(sub { \"x\".(\$_[0] // \"u\").\"x\" })"), "xux/xax";
1163 is eval("t133(sub { \"x\".(\$_[0] // \"u\").\"x\" }, 789)"), undef;
1164 like $@, qr/\AToo many arguments for subroutine at/;
1167 sub t134 ($a = sub ($a, $t = sub { $_[0]."p" }) { $t->($a)."z" }) {
1168 $a->("a")."/".$a->("b", sub { $_[0]."q" } )
1170 is prototype(\&t134), undef;
1171 is eval("t134()"), "apz/bqz";
1172 is eval("t134(sub { \"x\".(\$_[1] // sub{\$_[0]})->(\$_[0]).\"x\" })"),
1174 is eval("t134(sub { \"x\".(\$_[1] // sub{\$_[0]})->(\$_[0]).\"x\" }, 789)"),
1176 like $@, qr/\AToo many arguments for subroutine at/;
1179 sub t135 ($a = sub ($a, $t = sub ($p) { $p."p" }) { $t->($a)."z" }) {
1180 $a->("a")."/".$a->("b", sub { $_[0]."q" } )
1182 is prototype(\&t135), undef;
1183 is eval("t135()"), "apz/bqz";
1184 is eval("t135(sub { \"x\".(\$_[1] // sub{\$_[0]})->(\$_[0]).\"x\" })"),
1186 is eval("t135(sub { \"x\".(\$_[1] // sub{\$_[0]})->(\$_[0]).\"x\" }, 789)"),
1188 like $@, qr/\AToo many arguments for subroutine at/;
1192 $a = sub ($a, $t = sub ($p = 222) { $p."p" }) { $t->($a)."z".$t->() },
1194 $a->("a")."/".$a->("b", sub { ($_[0] // "u")."q" } )
1196 is prototype(\&t132), undef;
1197 is eval("t132()"), "apz222p/bqzuq";
1198 is eval("t132(sub { \"x\".(\$_[1] // sub{\$_[0]})->(\$_[0]).\"x\" })"),
1200 is eval("t132(sub { \"x\".(\$_[1] // sub{\$_[0]})->(\$_[0]).\"x\" }, 789)"),
1202 like $@, qr/\AToo many arguments for subroutine at/;
1205 sub t104 :method ($a) { $a || "z" }
1206 is prototype(\&t104), undef;
1207 is eval("t104()"), undef;
1208 like $@, qr/\AToo few arguments for subroutine at/;
1209 is eval("t104(0)"), "z";
1210 is eval("t104(456)"), 456;
1211 is eval("t104(456, 789)"), undef;
1212 like $@, qr/\AToo many arguments for subroutine at/;
1213 is eval("t104(456, 789, 987)"), undef;
1214 like $@, qr/\AToo many arguments for subroutine at/;
1217 sub t105 :prototype($) ($a) { $a || "z" }
1218 is prototype(\&t105), "\$";
1219 is eval("t105()"), undef;
1220 like $@, qr/\ANot enough arguments for main::t105 /;
1221 is eval("t105(0)"), "z";
1222 is eval("t105(456)"), 456;
1223 is eval("t105(456, 789)"), undef;
1224 like $@, qr/\AToo many arguments for main::t105 at/;
1225 is eval("t105(456, 789, 987)"), undef;
1226 like $@, qr/\AToo many arguments for main::t105 at/;
1229 sub t106 :prototype(@) ($a) { $a || "z" }
1230 is prototype(\&t106), "\@";
1231 is eval("t106()"), undef;
1232 like $@, qr/\AToo few arguments for subroutine at/;
1233 is eval("t106(0)"), "z";
1234 is eval("t106(456)"), 456;
1235 is eval("t106(456, 789)"), undef;
1236 like $@, qr/\AToo many arguments for subroutine at/;
1237 is eval("t106(456, 789, 987)"), undef;
1238 like $@, qr/\AToo many arguments for subroutine at/;
1241 eval "#line 8 foo\nsub t107 (\$a) :method { }";
1244 eval "#line 8 foo\nsub t108 (\$a) :prototype(\$) { }";
1248 is prototype(\&t109), undef;
1249 is scalar(@{[ t109() ]}), 0;
1250 is scalar(t109()), undef;
1253 is prototype(\&t110), undef;
1254 is scalar(@{[ t110() ]}), 0;
1255 is scalar(t110()), undef;
1258 is prototype(\&t111), undef;
1259 is scalar(@{[ t111(222) ]}), 0;
1260 is scalar(t111(222)), undef;
1263 is prototype(\&t112), undef;
1264 is scalar(@{[ t112(222) ]}), 0;
1265 is scalar(t112(222)), undef;
1267 sub t114 ($a = undef) { }
1268 is prototype(\&t114), undef;
1269 is scalar(@{[ t114() ]}), 0;
1270 is scalar(t114()), undef;
1271 is scalar(@{[ t114(333) ]}), 0;
1272 is scalar(t114(333)), undef;
1274 sub t113 ($a = 222) { }
1275 is prototype(\&t113), undef;
1276 is scalar(@{[ t113() ]}), 0;
1277 is scalar(t113()), undef;
1278 is scalar(@{[ t113(333) ]}), 0;
1279 is scalar(t113(333)), undef;
1281 sub t115 ($a = do { $z++; 222 }) { }
1282 is prototype(\&t115), undef;
1284 is scalar(@{[ t115() ]}), 0;
1286 is scalar(t115()), undef;
1288 is scalar(@{[ t115(333) ]}), 0;
1289 is scalar(t115(333)), undef;
1293 is prototype(\&t116), undef;
1294 is scalar(@{[ t116() ]}), 0;
1295 is scalar(t116()), undef;
1296 is scalar(@{[ t116(333) ]}), 0;
1297 is scalar(t116(333)), undef;
1300 is prototype(\&t117), undef;
1301 is scalar(@{[ t117() ]}), 0;
1302 is scalar(t117()), undef;
1303 is scalar(@{[ t117(333, 444) ]}), 0;
1304 is scalar(t117(333, 444)), undef;