1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
BEGIN {
chdir 't';
require './test.pl';
set_up_inc("../lib");
}
plan 13;
$::TODO = ' ';
eval '\$x = \$y';
like $@, qr/^Experimental lvalue references not enabled/,
'error when feature is disabled';
use feature 'lvalue_refs';
{
my($w,$c);
local $SIG{__WARN__} = sub { $c++; $w = shift };
eval '\$x = \$y';
is $c, 1, 'one warning from lv ref assignment';
like $w, qr/^Lvalue references are experimental/,
'experimental warning';
}
no warnings 'experimental::lvalue_refs';
# Scalars
eval '\$x = \$y';
is \$x, \$y, '\$pkg_scalar = ...';
my $m;
eval '\$m = \$y';
is \$m, \$y, '\$lexical = ...';
eval '\my $n = \$y';
is \$n, \$y, '\my $lexical = ...';
@_ = \$_;
eval '\($x) = @_';
is \$x, \$_, '\($pkgvar) = ... gives list context';
my $o;
eval '\($o) = @_';
is \$o, \$_, '\($lexical) = ... gives list cx';
eval '\(my $p) = @_';
is \$p, \$_, '\(my $lexical) = ... gives list cx';
eval '\($_a, my $a) = @{[\$b, \$c]}';
is \$_a, \$b, 'package scalar in \(...)';
is \$a, \$c, 'lex scalar in \(...)';
eval '(\$_b, \my $b) = @{[\$b, \$c]}';
is \$_b, \$::b, 'package scalar in (\$foo, \$bar)';
is \$b, \$c, 'lex scalar in (\$foo, \$bar)';
# Array Elements
# ...
# Hash Elements
# ...
# Arrays
# ...
# Hashes
# ...
# Subroutines
# ...
# Mixed List Assignments
# ...
# Errors
# ...
|