Commit | Line | Data |
---|---|---|
599cee73 | 1 | Check interaction of $^W and lexical |
2 | ||
3 | __END__ | |
4 | ||
4438c4b7 | 5 | # Check interaction of $^W and use warnings |
599cee73 | 6 | sub fred { |
4438c4b7 | 7 | use warnings ; |
599cee73 | 8 | my $b ; |
9 | chop $b ; | |
10 | } | |
11 | { local $^W = 0 ; | |
12 | fred() ; | |
13 | } | |
14 | ||
15 | EXPECT | |
b89fed5f | 16 | Use of uninitialized value in scalar chop at - line 6. |
599cee73 | 17 | ######## |
18 | ||
4438c4b7 | 19 | # Check interaction of $^W and use warnings |
599cee73 | 20 | sub fred { |
4438c4b7 | 21 | use warnings ; |
0453d815 | 22 | my $b ; |
23 | chop $b ; | |
24 | } | |
25 | { $^W = 0 ; | |
26 | fred() ; | |
27 | } | |
28 | ||
29 | EXPECT | |
b89fed5f | 30 | Use of uninitialized value in scalar chop at - line 6. |
0453d815 | 31 | ######## |
32 | ||
4438c4b7 | 33 | # Check interaction of $^W and use warnings |
0453d815 | 34 | sub fred { |
4438c4b7 | 35 | no warnings ; |
599cee73 | 36 | my $b ; |
37 | chop $b ; | |
38 | } | |
39 | { local $^W = 1 ; | |
40 | fred() ; | |
41 | } | |
42 | ||
43 | EXPECT | |
0453d815 | 44 | |
45 | ######## | |
46 | ||
4438c4b7 | 47 | # Check interaction of $^W and use warnings |
0453d815 | 48 | sub fred { |
4438c4b7 | 49 | no warnings ; |
0453d815 | 50 | my $b ; |
51 | chop $b ; | |
52 | } | |
53 | { $^W = 1 ; | |
54 | fred() ; | |
55 | } | |
56 | ||
57 | EXPECT | |
58 | ||
599cee73 | 59 | ######## |
60 | ||
4438c4b7 | 61 | # Check interaction of $^W and use warnings |
62 | use warnings ; | |
599cee73 | 63 | $^W = 1 ; |
64 | my $b ; | |
65 | chop $b ; | |
66 | EXPECT | |
b89fed5f | 67 | Use of uninitialized value in scalar chop at - line 6. |
599cee73 | 68 | ######## |
69 | ||
4438c4b7 | 70 | # Check interaction of $^W and use warnings |
599cee73 | 71 | $^W = 1 ; |
4438c4b7 | 72 | use warnings ; |
599cee73 | 73 | my $b ; |
74 | chop $b ; | |
75 | EXPECT | |
b89fed5f | 76 | Use of uninitialized value in scalar chop at - line 6. |
599cee73 | 77 | ######## |
78 | ||
4438c4b7 | 79 | # Check interaction of $^W and use warnings |
599cee73 | 80 | $^W = 1 ; |
4438c4b7 | 81 | no warnings ; |
599cee73 | 82 | my $b ; |
83 | chop $b ; | |
84 | EXPECT | |
0453d815 | 85 | |
599cee73 | 86 | ######## |
87 | ||
4438c4b7 | 88 | # Check interaction of $^W and use warnings |
89 | no warnings ; | |
599cee73 | 90 | $^W = 1 ; |
91 | my $b ; | |
92 | chop $b ; | |
93 | EXPECT | |
0453d815 | 94 | |
95 | ######## | |
96 | -w | |
4438c4b7 | 97 | # Check interaction of $^W and use warnings |
98 | no warnings ; | |
0453d815 | 99 | my $b ; |
100 | chop $b ; | |
101 | EXPECT | |
102 | ||
103 | ######## | |
104 | -w | |
4438c4b7 | 105 | # Check interaction of $^W and use warnings |
106 | use warnings ; | |
0453d815 | 107 | my $b ; |
108 | chop $b ; | |
109 | EXPECT | |
b89fed5f | 110 | Use of uninitialized value in scalar chop at - line 5. |
0453d815 | 111 | ######## |
112 | ||
4438c4b7 | 113 | # Check interaction of $^W and use warnings |
0453d815 | 114 | sub fred { |
4438c4b7 | 115 | use warnings ; |
0453d815 | 116 | my $b ; |
117 | chop $b ; | |
118 | } | |
119 | BEGIN { $^W = 0 } | |
120 | fred() ; | |
121 | EXPECT | |
b89fed5f | 122 | Use of uninitialized value in scalar chop at - line 6. |
0453d815 | 123 | ######## |
124 | ||
4438c4b7 | 125 | # Check interaction of $^W and use warnings |
0453d815 | 126 | sub fred { |
4438c4b7 | 127 | no warnings ; |
0453d815 | 128 | my $b ; |
129 | chop $b ; | |
130 | } | |
131 | BEGIN { $^W = 1 } | |
132 | fred() ; | |
133 | ||
134 | EXPECT | |
135 | ||
136 | ######## | |
137 | ||
4438c4b7 | 138 | # Check interaction of $^W and use warnings |
139 | use warnings ; | |
0453d815 | 140 | BEGIN { $^W = 1 } |
141 | my $b ; | |
142 | chop $b ; | |
143 | EXPECT | |
b89fed5f | 144 | Use of uninitialized value in scalar chop at - line 6. |
0453d815 | 145 | ######## |
146 | ||
4438c4b7 | 147 | # Check interaction of $^W and use warnings |
0453d815 | 148 | BEGIN { $^W = 1 } |
4438c4b7 | 149 | use warnings ; |
0453d815 | 150 | my $b ; |
151 | chop $b ; | |
152 | EXPECT | |
b89fed5f | 153 | Use of uninitialized value in scalar chop at - line 6. |
0453d815 | 154 | ######## |
155 | ||
4438c4b7 | 156 | # Check interaction of $^W and use warnings |
0453d815 | 157 | BEGIN { $^W = 1 } |
4438c4b7 | 158 | no warnings ; |
0453d815 | 159 | my $b ; |
160 | chop $b ; | |
161 | EXPECT | |
162 | ||
163 | ######## | |
164 | ||
4438c4b7 | 165 | # Check interaction of $^W and use warnings |
166 | no warnings ; | |
0453d815 | 167 | BEGIN { $^W = 1 } |
168 | my $b ; | |
169 | chop $b ; | |
170 | EXPECT | |
171 | ||
172 | ######## | |
173 | ||
4438c4b7 | 174 | # Check interaction of $^W and use warnings |
0453d815 | 175 | BEGIN { $^W = 1 } |
176 | { | |
4438c4b7 | 177 | no warnings ; |
0453d815 | 178 | my $b ; |
179 | chop $b ; | |
180 | } | |
181 | my $b ; | |
182 | chop $b ; | |
183 | EXPECT | |
b89fed5f | 184 | Use of uninitialized value in scalar chop at - line 10. |
0453d815 | 185 | ######## |
186 | ||
4438c4b7 | 187 | # Check interaction of $^W and use warnings |
0453d815 | 188 | BEGIN { $^W = 0 } |
189 | { | |
4438c4b7 | 190 | use warnings ; |
0453d815 | 191 | my $b ; |
192 | chop $b ; | |
193 | } | |
194 | my $b ; | |
195 | chop $b ; | |
196 | EXPECT | |
b89fed5f | 197 | Use of uninitialized value in scalar chop at - line 7. |
16ff4256 | 198 | ######## |
199 | ||
200 | # Check scope of pragma with eval | |
201 | BEGIN { $^W = 1 } | |
202 | { | |
203 | no warnings ; | |
204 | eval ' | |
205 | my $b ; chop $b ; | |
206 | '; print STDERR $@ ; | |
207 | my $b ; chop $b ; | |
208 | } | |
209 | EXPECT | |
210 | ||
211 | ######## | |
212 | ||
213 | # Check scope of pragma with eval | |
214 | BEGIN { $^W = 1 } | |
215 | use warnings; | |
216 | { | |
217 | no warnings ; | |
218 | eval q[ | |
219 | use warnings 'uninitialized' ; | |
220 | my $b ; chop $b ; | |
221 | ]; print STDERR $@; | |
222 | my $b ; chop $b ; | |
223 | } | |
224 | EXPECT | |
225 | Use of uninitialized value in scalar chop at (eval 1) line 3. | |
226 | ######## | |
227 | ||
228 | # Check scope of pragma with eval | |
229 | BEGIN { $^W = 0 } | |
230 | { | |
231 | use warnings 'uninitialized' ; | |
232 | eval ' | |
233 | my $b ; chop $b ; | |
234 | '; print STDERR $@ ; | |
235 | my $b ; chop $b ; | |
236 | } | |
237 | EXPECT | |
238 | Use of uninitialized value in scalar chop at (eval 1) line 2. | |
239 | Use of uninitialized value in scalar chop at - line 9. | |
240 | ######## | |
241 | ||
242 | # Check scope of pragma with eval | |
243 | BEGIN { $^W = 0 } | |
244 | { | |
245 | use warnings 'uninitialized' ; | |
246 | eval ' | |
247 | no warnings ; | |
248 | my $b ; chop $b ; | |
249 | '; print STDERR $@ ; | |
250 | my $b ; chop $b ; | |
251 | } | |
252 | EXPECT | |
253 | Use of uninitialized value in scalar chop at - line 10. | |
254 | ######## | |
255 | ||
256 | # Check scope of pragma with eval | |
257 | BEGIN { $^W = 1 } | |
258 | { | |
259 | no warnings ; | |
260 | eval ' | |
551cd33c | 261 | my $a =+ 1 ; |
16ff4256 | 262 | '; print STDERR $@ ; |
551cd33c | 263 | my $a =+ 1 ; |
16ff4256 | 264 | } |
265 | EXPECT | |
266 |