11 # test various operations on @_
13 sub new1 { bless \@_ }
17 is("@$y","y", 'bless');
18 is("@$x","x", 'bless');
21 sub new2 { splice @_, 0, 0, "a", "b", "c"; return \@_ }
25 is("@$x","a b c x", 'splice');
26 is("@$y","a b c y", 'splice');
29 sub new3 { goto &new1 }
33 is("@$y","y", 'goto: single element');
34 is("@$x","x", 'goto: single element');
37 sub new4 { goto &new2 }
41 is("@$x","a b c x", 'goto: multiple elements');
42 is("@$y","a b c y", 'goto: multiple elements');
45 # see if POPSUB gets to see the right pad across a dounwind() with
59 eval { method('foo', 'bar'); };
66 'POPSUB sees right pad across a dounwind() with reified @_');
68 # bug #21542 local $_[0] causes reify problems and coredumps
70 sub local1 { local $_[0] }
71 my $foo = 'foo'; local1($foo); local1($foo);
73 "got 'foo' as expected rather than '\$foo': RT \#21542");
75 sub local2 { local $_[0]; last L }
77 pass("last to label");
79 # the following test for local(@_) used to be in t/op/nothr5005.t (because it
80 # failed with 5005threads)
84 sub foo { local(@_) = ('p', 'q', 'r'); }
85 sub bar { unshift @_, 'D'; @_ }
86 sub baz { push @_, 'E'; return @_ }
88 is(join('',foo('a', 'b', 'c')),'pqr', 'local @_');
89 is(join('',bar('d')),'Dd', 'unshift @_');
90 is(join('',baz('e')),'eE', 'push @_');
93 # [perl #28032] delete $_[0] was freeing things too early
97 sub X::DESTROY { $flag = 1 }
100 ok(!$flag, 'delete $_[0] : in f');
103 my $x = bless [], 'X';
105 ok(!$flag, 'delete $_[0] : after f');
107 ok($flag, 'delete $_[0] : outside block');