Commit | Line | Data |
---|---|---|
f21d7107 | 1 | pad.c AOK |
2 | ||
3 | "my" variable %s masks earlier declaration in same scope | |
4 | my $x; | |
5 | my $x ; | |
6 | ||
b5c19bd7 | 7 | Variable "%s" will not stay shared |
f21d7107 | 8 | sub x { |
9 | my $x; | |
10 | sub y { | |
b5c19bd7 | 11 | sub { $x } |
f21d7107 | 12 | } |
13 | } | |
14 | ||
f21d7107 | 15 | sub x { |
16 | my $x; | |
17 | sub y { | |
b5c19bd7 | 18 | $x |
f21d7107 | 19 | } |
20 | } | |
b5c19bd7 | 21 | |
f21d7107 | 22 | "our" variable %s redeclared (Did you mean "local" instead of "our"?) |
23 | our $x; | |
24 | { | |
25 | our $x; | |
26 | } | |
27 | ||
28 | %s never introduced [pad_leavemy] TODO | |
29 | ||
30 | __END__ | |
31 | # pad.c | |
32 | use warnings 'misc' ; | |
33 | my $x ; | |
34 | my $x ; | |
35 | my $y = my $y ; | |
36 | no warnings 'misc' ; | |
37 | my $x ; | |
38 | my $y ; | |
39 | EXPECT | |
40 | "my" variable $x masks earlier declaration in same scope at - line 4. | |
41 | "my" variable $y masks earlier declaration in same statement at - line 5. | |
42 | ######## | |
43 | # pad.c | |
44 | use warnings 'closure' ; | |
45 | sub x { | |
46 | my $x; | |
47 | sub y { | |
48 | $x | |
49 | } | |
50 | } | |
51 | EXPECT | |
52 | Variable "$x" will not stay shared at - line 7. | |
53 | ######## | |
54 | # pad.c | |
55 | no warnings 'closure' ; | |
56 | sub x { | |
57 | my $x; | |
58 | sub y { | |
59 | $x | |
60 | } | |
61 | } | |
62 | EXPECT | |
63 | ||
64 | ######## | |
65 | # pad.c | |
66 | use warnings 'closure' ; | |
67 | sub x { | |
b5c19bd7 | 68 | my $x; |
f21d7107 | 69 | sub y { |
b5c19bd7 | 70 | sub { $x } |
f21d7107 | 71 | } |
72 | } | |
73 | EXPECT | |
b5c19bd7 | 74 | Variable "$x" will not stay shared at - line 6. |
75 | ######## | |
76 | # pad.c | |
77 | use warnings 'closure' ; | |
78 | sub x { | |
79 | my $x; | |
80 | sub { | |
81 | $x; | |
82 | sub y { | |
83 | $x | |
84 | } | |
85 | }->(); | |
86 | } | |
87 | EXPECT | |
88 | Variable "$x" will not stay shared at - line 9. | |
89 | ######## | |
90 | # pad.c | |
91 | use warnings 'closure' ; | |
92 | my $x; | |
93 | sub { | |
94 | $x; | |
95 | sub f { | |
96 | sub { $x }->(); | |
97 | } | |
98 | }->(); | |
99 | EXPECT | |
f21d7107 | 100 | |
101 | ######## | |
102 | # pad.c | |
103 | use warnings 'closure' ; | |
b5c19bd7 | 104 | sub { |
105 | my $x; | |
106 | sub f { $x } | |
107 | }->(); | |
108 | EXPECT | |
109 | Variable "$x" is not available at - line 5. | |
110 | ######## | |
111 | # pad.c | |
112 | use warnings 'closure' ; | |
113 | sub { | |
114 | my $x; | |
115 | eval 'sub f { $x }'; | |
116 | }->(); | |
117 | EXPECT | |
118 | ||
119 | ######## | |
120 | # pad.c | |
121 | use warnings 'closure' ; | |
122 | sub { | |
123 | my $x; | |
124 | sub f { eval '$x' } | |
125 | }->(); | |
126 | f(); | |
127 | EXPECT | |
128 | Variable "$x" is not available at (eval 1) line 2. | |
129 | ######## | |
130 | # pad.c | |
131 | use warnings 'closure' ; | |
f21d7107 | 132 | sub x { |
b5c19bd7 | 133 | our $x; |
f21d7107 | 134 | sub y { |
b5c19bd7 | 135 | $x |
f21d7107 | 136 | } |
137 | } | |
138 | EXPECT | |
b5c19bd7 | 139 | |
140 | ######## | |
141 | # pad.c | |
142 | # see bugid 1754 | |
143 | use warnings 'closure' ; | |
144 | sub f { | |
145 | my $x; | |
146 | sub { eval '$x' }; | |
147 | } | |
148 | f()->(); | |
149 | EXPECT | |
150 | Variable "$x" is not available at (eval 1) line 2. | |
f21d7107 | 151 | ######## |
152 | # pad.c | |
153 | no warnings 'closure' ; | |
154 | sub x { | |
155 | my $x; | |
156 | sub y { | |
157 | sub { $x } | |
158 | } | |
159 | } | |
160 | EXPECT | |
161 | ||
162 | ######## | |
163 | use warnings 'misc' ; | |
164 | our $x; | |
165 | { | |
166 | our $x; | |
167 | } | |
168 | EXPECT | |
169 | "our" variable $x redeclared at - line 4. | |
170 | (Did you mean "local" instead of "our"?) |