Commit | Line | Data |
---|---|---|
4438c4b7 | 1 | Check FATAL functionality |
2 | ||
3 | __END__ | |
4 | ||
5 | # Check compile time warning | |
551cd33c | 6 | use warnings FATAL => 'syntax' ; |
4438c4b7 | 7 | { |
8 | no warnings ; | |
551cd33c | 9 | $a =+ 1 ; |
4438c4b7 | 10 | } |
551cd33c | 11 | $a =+ 1 ; |
4438c4b7 | 12 | print STDERR "The End.\n" ; |
13 | EXPECT | |
551cd33c | 14 | Reversed += operator at - line 8. |
4438c4b7 | 15 | ######## |
16 | ||
d5a71f30 | 17 | # Check compile time warning |
18 | use warnings FATAL => 'all' ; | |
19 | { | |
20 | no warnings ; | |
551cd33c | 21 | my $a =+ 1 ; |
d5a71f30 | 22 | } |
551cd33c | 23 | my $a =+ 1 ; |
d5a71f30 | 24 | print STDERR "The End.\n" ; |
25 | EXPECT | |
551cd33c | 26 | Reversed += operator at - line 8. |
d5a71f30 | 27 | ######## |
28 | ||
4438c4b7 | 29 | # Check runtime scope of pragma |
30 | use warnings FATAL => 'uninitialized' ; | |
31 | { | |
32 | no warnings ; | |
33 | my $b ; chop $b ; | |
34 | } | |
35 | my $b ; chop $b ; | |
36 | print STDERR "The End.\n" ; | |
37 | EXPECT | |
b89fed5f | 38 | Use of uninitialized value in scalar chop at - line 8. |
4438c4b7 | 39 | ######## |
40 | ||
41 | # Check runtime scope of pragma | |
d5a71f30 | 42 | use warnings FATAL => 'all' ; |
43 | { | |
44 | no warnings ; | |
45 | my $b ; chop $b ; | |
46 | } | |
47 | my $b ; chop $b ; | |
48 | print STDERR "The End.\n" ; | |
49 | EXPECT | |
50 | Use of uninitialized value in scalar chop at - line 8. | |
51 | ######## | |
52 | ||
53 | # Check runtime scope of pragma | |
4438c4b7 | 54 | no warnings ; |
55 | { | |
56 | use warnings FATAL => 'uninitialized' ; | |
57 | $a = sub { my $b ; chop $b ; } | |
58 | } | |
59 | &$a ; | |
60 | print STDERR "The End.\n" ; | |
61 | EXPECT | |
b89fed5f | 62 | Use of uninitialized value in scalar chop at - line 6. |
4438c4b7 | 63 | ######## |
d5a71f30 | 64 | |
65 | # Check runtime scope of pragma | |
66 | no warnings ; | |
67 | { | |
68 | use warnings FATAL => 'all' ; | |
69 | $a = sub { my $b ; chop $b ; } | |
70 | } | |
71 | &$a ; | |
72 | print STDERR "The End.\n" ; | |
73 | EXPECT | |
74 | Use of uninitialized value in scalar chop at - line 6. | |
75 | ######## | |
4438c4b7 | 76 | |
77 | --FILE-- abc | |
551cd33c | 78 | $a =+ 1 ; |
4438c4b7 | 79 | 1; |
80 | --FILE-- | |
551cd33c | 81 | use warnings FATAL => 'syntax' ; |
4438c4b7 | 82 | require "./abc"; |
83 | EXPECT | |
84 | ||
85 | ######## | |
86 | ||
87 | --FILE-- abc | |
551cd33c | 88 | use warnings FATAL => 'syntax' ; |
4438c4b7 | 89 | 1; |
90 | --FILE-- | |
91 | require "./abc"; | |
551cd33c | 92 | $a =+ 1 ; |
4438c4b7 | 93 | EXPECT |
94 | ||
95 | ######## | |
96 | ||
97 | --FILE-- abc | |
551cd33c | 98 | use warnings 'syntax' ; |
99 | $a =+ 1 ; | |
4438c4b7 | 100 | 1; |
101 | --FILE-- | |
102 | use warnings FATAL => 'uninitialized' ; | |
103 | require "./abc"; | |
104 | my $a ; chop $a ; | |
105 | print STDERR "The End.\n" ; | |
106 | EXPECT | |
551cd33c | 107 | Reversed += operator at ./abc line 2. |
b89fed5f | 108 | Use of uninitialized value in scalar chop at - line 3. |
4438c4b7 | 109 | ######## |
110 | ||
111 | --FILE-- abc.pm | |
551cd33c | 112 | use warnings 'syntax' ; |
113 | $a =+ 1 ; | |
4438c4b7 | 114 | 1; |
115 | --FILE-- | |
116 | use warnings FATAL => 'uninitialized' ; | |
117 | use abc; | |
118 | my $a ; chop $a ; | |
119 | print STDERR "The End.\n" ; | |
120 | EXPECT | |
551cd33c | 121 | Reversed += operator at abc.pm line 2. |
b89fed5f | 122 | Use of uninitialized value in scalar chop at - line 3. |
4438c4b7 | 123 | ######## |
124 | ||
125 | # Check scope of pragma with eval | |
126 | no warnings ; | |
127 | eval { | |
128 | use warnings FATAL => 'uninitialized' ; | |
129 | my $b ; chop $b ; | |
130 | }; print STDERR "-- $@" ; | |
131 | my $b ; chop $b ; | |
132 | print STDERR "The End.\n" ; | |
133 | EXPECT | |
b89fed5f | 134 | -- Use of uninitialized value in scalar chop at - line 6. |
4438c4b7 | 135 | The End. |
136 | ######## | |
137 | ||
138 | # Check scope of pragma with eval | |
139 | use warnings FATAL => 'uninitialized' ; | |
140 | eval { | |
141 | my $b ; chop $b ; | |
142 | }; print STDERR "-- $@" ; | |
143 | my $b ; chop $b ; | |
144 | print STDERR "The End.\n" ; | |
145 | EXPECT | |
b89fed5f | 146 | -- Use of uninitialized value in scalar chop at - line 5. |
147 | Use of uninitialized value in scalar chop at - line 7. | |
4438c4b7 | 148 | ######## |
149 | ||
150 | # Check scope of pragma with eval | |
151 | use warnings FATAL => 'uninitialized' ; | |
152 | eval { | |
153 | no warnings ; | |
154 | my $b ; chop $b ; | |
155 | }; print STDERR $@ ; | |
156 | my $b ; chop $b ; | |
157 | print STDERR "The End.\n" ; | |
158 | EXPECT | |
b89fed5f | 159 | Use of uninitialized value in scalar chop at - line 8. |
4438c4b7 | 160 | ######## |
161 | ||
162 | # Check scope of pragma with eval | |
163 | no warnings ; | |
164 | eval { | |
551cd33c | 165 | use warnings FATAL => 'syntax' ; |
166 | $a =+ 1 ; | |
4438c4b7 | 167 | }; print STDERR "-- $@" ; |
551cd33c | 168 | $a =+ 1 ; |
4438c4b7 | 169 | print STDERR "The End.\n" ; |
170 | EXPECT | |
551cd33c | 171 | Reversed += operator at - line 6. |
4438c4b7 | 172 | ######## |
173 | ||
174 | # Check scope of pragma with eval | |
551cd33c | 175 | use warnings FATAL => 'syntax' ; |
4438c4b7 | 176 | eval { |
551cd33c | 177 | $a =+ 1 ; |
4438c4b7 | 178 | }; print STDERR "-- $@" ; |
551cd33c | 179 | $a =+ 1 ; |
4438c4b7 | 180 | print STDERR "The End.\n" ; |
181 | EXPECT | |
551cd33c | 182 | Reversed += operator at - line 5. |
4438c4b7 | 183 | ######## |
184 | ||
185 | # Check scope of pragma with eval | |
551cd33c | 186 | use warnings FATAL => 'syntax' ; |
4438c4b7 | 187 | eval { |
188 | no warnings ; | |
551cd33c | 189 | $a =+ 1 ; |
4438c4b7 | 190 | }; print STDERR $@ ; |
551cd33c | 191 | $a =+ 1 ; |
4438c4b7 | 192 | print STDERR "The End.\n" ; |
193 | EXPECT | |
551cd33c | 194 | Reversed += operator at - line 8. |
4438c4b7 | 195 | ######## |
196 | ||
197 | # Check scope of pragma with eval | |
198 | no warnings ; | |
199 | eval { | |
551cd33c | 200 | use warnings FATAL => 'syntax' ; |
4438c4b7 | 201 | }; print STDERR $@ ; |
551cd33c | 202 | $a =+ 1 ; |
4438c4b7 | 203 | print STDERR "The End.\n" ; |
204 | EXPECT | |
205 | The End. | |
206 | ######## | |
207 | ||
208 | # Check scope of pragma with eval | |
209 | no warnings ; | |
210 | eval q[ | |
211 | use warnings FATAL => 'uninitialized' ; | |
212 | my $b ; chop $b ; | |
213 | ]; print STDERR "-- $@"; | |
214 | my $b ; chop $b ; | |
215 | print STDERR "The End.\n" ; | |
216 | EXPECT | |
b89fed5f | 217 | -- Use of uninitialized value in scalar chop at (eval 1) line 3. |
4438c4b7 | 218 | The End. |
219 | ######## | |
220 | ||
221 | # Check scope of pragma with eval | |
222 | use warnings FATAL => 'uninitialized' ; | |
223 | eval ' | |
224 | my $b ; chop $b ; | |
225 | '; print STDERR "-- $@" ; | |
226 | my $b ; chop $b ; | |
227 | print STDERR "The End.\n" ; | |
228 | EXPECT | |
b89fed5f | 229 | -- Use of uninitialized value in scalar chop at (eval 1) line 2. |
230 | Use of uninitialized value in scalar chop at - line 7. | |
4438c4b7 | 231 | ######## |
232 | ||
233 | # Check scope of pragma with eval | |
234 | use warnings FATAL => 'uninitialized' ; | |
235 | eval ' | |
236 | no warnings ; | |
237 | my $b ; chop $b ; | |
238 | '; print STDERR $@ ; | |
239 | my $b ; chop $b ; | |
240 | print STDERR "The End.\n" ; | |
241 | EXPECT | |
b89fed5f | 242 | Use of uninitialized value in scalar chop at - line 8. |
4438c4b7 | 243 | ######## |
244 | ||
245 | # Check scope of pragma with eval | |
246 | no warnings ; | |
247 | eval q[ | |
551cd33c | 248 | use warnings FATAL => 'syntax' ; |
249 | $a =+ 1 ; | |
4438c4b7 | 250 | ]; print STDERR "-- $@"; |
551cd33c | 251 | $a =+ 1 ; |
4438c4b7 | 252 | print STDERR "The End.\n" ; |
253 | EXPECT | |
551cd33c | 254 | -- Reversed += operator at (eval 1) line 3. |
4438c4b7 | 255 | The End. |
256 | ######## | |
257 | ||
258 | # Check scope of pragma with eval | |
551cd33c | 259 | use warnings FATAL => 'syntax' ; |
4438c4b7 | 260 | eval ' |
551cd33c | 261 | $a =+ 1 ; |
4438c4b7 | 262 | '; print STDERR "-- $@"; |
263 | print STDERR "The End.\n" ; | |
264 | EXPECT | |
551cd33c | 265 | -- Reversed += operator at (eval 1) line 2. |
4438c4b7 | 266 | The End. |
267 | ######## | |
268 | ||
269 | # Check scope of pragma with eval | |
551cd33c | 270 | use warnings FATAL => 'syntax' ; |
4438c4b7 | 271 | eval ' |
272 | no warnings ; | |
551cd33c | 273 | $a =+ 1 ; |
4438c4b7 | 274 | '; print STDERR "-- $@"; |
551cd33c | 275 | $a =+ 1 ; |
4438c4b7 | 276 | print STDERR "The End.\n" ; |
277 | EXPECT | |
551cd33c | 278 | Reversed += operator at - line 8. |
f1f33818 | 279 | ######## |
280 | ||
281 | use warnings 'void' ; | |
282 | ||
283 | time ; | |
284 | ||
285 | { | |
286 | use warnings FATAL => qw(void) ; | |
287 | length "abc" ; | |
288 | } | |
289 | ||
290 | join "", 1,2,3 ; | |
291 | ||
292 | print "done\n" ; | |
293 | EXPECT | |
294 | Useless use of time in void context at - line 4. | |
295 | Useless use of length in void context at - line 8. | |
296 | ######## | |
297 | ||
298 | use warnings ; | |
299 | ||
300 | time ; | |
301 | ||
302 | { | |
303 | use warnings FATAL => qw(void) ; | |
304 | length "abc" ; | |
305 | } | |
306 | ||
307 | join "", 1,2,3 ; | |
308 | ||
309 | print "done\n" ; | |
310 | EXPECT | |
311 | Useless use of time in void context at - line 4. | |
312 | Useless use of length in void context at - line 8. |