forbid -l _ after -T _
[p5sagit/p5-mst-13.2.git] / t / lib / warnings / pp_sys
1   pp_sys.c      AOK
2
3   untie attempted while %d inner references still exist [pp_untie]
4     sub TIESCALAR { bless [] } ; tie $a, 'main'; untie $a ;
5
6   fileno() on unopened filehandle abc           [pp_fileno]
7     $a = "abc"; fileno($a)
8
9   binmode() on unopened filehandle abc          [pp_binmode]
10     $a = "abc"; fileno($a)
11
12   printf() on unopened filehandle abc           [pp_prtf]
13     $a = "abc"; printf $a "fred"
14
15   Filehandle %s opened only for input           [pp_leavewrite]
16     format STDIN =
17     .
18     write STDIN;
19
20   write() on closed filehandle %s               [pp_leavewrite]
21     format STDIN =
22     .
23     close STDIN;
24     write STDIN ;
25
26   page overflow                                 [pp_leavewrite]
27
28   printf() on unopened filehandle abc           [pp_prtf]
29     $a = "abc"; printf $a "fred"
30
31   Filehandle %s opened only for input           [pp_prtf]
32     $a = "abc"; 
33     printf $a "fred"
34
35   printf() on closed filehandle %s              [pp_prtf]
36     close STDIN ;
37     printf STDIN "fred"
38
39   syswrite() on closed filehandle %s            [pp_send]
40     close STDIN; 
41     syswrite STDIN, "fred", 1;
42
43   send() on closed socket %s                    [pp_send]
44     close STDIN; 
45     send STDIN, "fred", 1
46
47   bind() on closed socket %s                    [pp_bind]
48     close STDIN; 
49     bind STDIN, "fred" ;
50
51
52   connect() on closed socket %s                 [pp_connect]
53     close STDIN; 
54     connect STDIN, "fred" ;
55
56   listen() on closed socket %s                  [pp_listen]
57     close STDIN; 
58     listen STDIN, 2;
59
60   accept() on closed socket %s                  [pp_accept]
61     close STDIN; 
62     accept "fred", STDIN ;
63
64   shutdown() on closed socket %s                [pp_shutdown]
65     close STDIN; 
66     shutdown STDIN, 0;
67
68   setsockopt() on closed socket %s              [pp_ssockopt]
69   getsockopt() on closed socket %s              [pp_ssockopt]
70     close STDIN; 
71     setsockopt STDIN, 1,2,3;
72     getsockopt STDIN, 1,2;
73
74   getsockname() on closed socket %s             [pp_getpeername]
75   getpeername() on closed socket %s             [pp_getpeername]
76     close STDIN; 
77     getsockname STDIN;
78     getpeername STDIN;
79
80   flock() on closed socket %s                   [pp_flock]
81   flock() on closed socket                      [pp_flock]
82     close STDIN;
83     flock STDIN, 8;
84     flock $a, 8;
85
86   warn(warn_nl, "stat");                        [pp_stat]
87
88   -T on closed filehandle %s
89   stat() on closed filehandle %s
90         close STDIN ; -T STDIN ; stat(STDIN) ;
91
92   warn(warn_nl, "open");                        [pp_fttext]
93     -T "abc\ndef" ;
94
95   Filehandle %s opened only for output          [pp_sysread]
96         my $file = "./xcv" ;
97         open(F, ">$file") ; 
98         my $a = sysread(F, $a,10) ;
99   
100   
101
102 __END__
103 # pp_sys.c [pp_untie]
104 use warnings 'untie' ;
105 sub TIESCALAR { bless [] } ; 
106 $b = tie $a, 'main'; 
107 untie $a ;
108 no warnings 'untie' ;
109 $c = tie $d, 'main'; 
110 untie $d ;
111 EXPECT
112 untie attempted while 1 inner references still exist at - line 5.
113 ########
114 # pp_sys.c [pp_leavewrite]
115 use warnings 'io' ;
116 format STDIN =
117 .
118 write STDIN;
119 no warnings 'io' ;
120 write STDIN;
121 EXPECT
122 Filehandle STDIN opened only for input at - line 5.
123 ########
124 # pp_sys.c [pp_leavewrite]
125 use warnings 'closed' ;
126 format STDIN =
127 .
128 close STDIN;
129 write STDIN;
130 opendir STDIN, ".";
131 write STDIN;
132 closedir STDIN;
133 no warnings 'closed' ;
134 write STDIN;
135 opendir STDIN, ".";
136 write STDIN;
137 EXPECT
138 write() on closed filehandle STDIN at - line 6.
139 write() on closed filehandle STDIN at - line 8.
140         (Are you trying to call write() on dirhandle STDIN?)
141 ########
142 # pp_sys.c [pp_leavewrite]
143 use warnings 'io' ;
144 format STDOUT_TOP =
145 abc
146 .
147 format STDOUT =
148 def
149 ghi
150 .
151 $= = 1 ;
152 $- =1 ;
153 open STDOUT, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ;
154 write ;
155 no warnings 'io' ;
156 write ;
157 EXPECT
158 page overflow at - line 13.
159 ########
160 # pp_sys.c [pp_prtf]
161 use warnings 'unopened' ;
162 $a = "abc"; 
163 printf $a "fred";
164 no warnings 'unopened' ;
165 printf $a "fred";
166 EXPECT
167 printf() on unopened filehandle abc at - line 4.
168 ########
169 # pp_sys.c [pp_prtf]
170 use warnings 'closed' ;
171 close STDIN ;
172 printf STDIN "fred";
173 opendir STDIN, ".";
174 printf STDIN "fred";
175 closedir STDIN;
176 no warnings 'closed' ;
177 printf STDIN "fred";
178 opendir STDIN, ".";
179 printf STDIN "fred";
180 EXPECT
181 printf() on closed filehandle STDIN at - line 4.
182 printf() on closed filehandle STDIN at - line 6.
183         (Are you trying to call printf() on dirhandle STDIN?)
184 ########
185 # pp_sys.c [pp_prtf]
186 use warnings 'io' ;
187 printf STDIN "fred";
188 no warnings 'io' ;
189 printf STDIN "fred";
190 EXPECT
191 Filehandle STDIN opened only for input at - line 3.
192 ########
193 # pp_sys.c [pp_send]
194 use warnings 'closed' ;
195 close STDIN; 
196 syswrite STDIN, "fred", 1;
197 opendir STDIN, ".";
198 syswrite STDIN, "fred", 1;
199 closedir STDIN;
200 no warnings 'closed' ;
201 syswrite STDIN, "fred", 1;
202 opendir STDIN, ".";
203 syswrite STDIN, "fred", 1;
204 EXPECT
205 syswrite() on closed filehandle STDIN at - line 4.
206 syswrite() on closed filehandle STDIN at - line 6.
207         (Are you trying to call syswrite() on dirhandle STDIN?)
208 ########
209 # pp_sys.c [pp_flock]
210 use Config; 
211 BEGIN { 
212   if ( !$Config{d_flock} &&
213        !$Config{d_fcntl_can_lock} &&
214        !$Config{d_lockf} ) {
215     print <<EOM ;
216 SKIPPED
217 # flock not present
218 EOM
219     exit ;
220   } 
221 }
222 use warnings qw(unopened closed);
223 close STDIN;
224 flock STDIN, 8;
225 opendir STDIN, ".";
226 flock STDIN, 8;
227 flock FOO, 8;
228 flock $a, 8;
229 no warnings qw(unopened closed);
230 flock STDIN, 8;
231 opendir STDIN, ".";
232 flock STDIN, 8;
233 flock FOO, 8;
234 flock $a, 8;
235 EXPECT
236 flock() on closed filehandle STDIN at - line 16.
237 flock() on closed filehandle STDIN at - line 18.
238         (Are you trying to call flock() on dirhandle STDIN?)
239 flock() on unopened filehandle FOO at - line 19.
240 flock() on unopened filehandle at - line 20.
241 ########
242 # pp_sys.c [pp_prtf pp_send pp_bind pp_connect pp_listen pp_accept pp_shutdown pp_ssockopt ppp_getpeername]
243 use warnings 'io' ;
244 use Config; 
245 BEGIN { 
246   if ( $^O ne 'VMS' and ! $Config{d_socket}) {
247     print <<EOM ;
248 SKIPPED
249 # send not present
250 # bind not present
251 # connect not present
252 # accept not present
253 # shutdown not present
254 # setsockopt not present
255 # getsockopt not present
256 # getsockname not present
257 # getpeername not present
258 EOM
259     exit ;
260   } 
261 }
262 close STDIN; 
263 send STDIN, "fred", 1;
264 bind STDIN, "fred" ;
265 connect STDIN, "fred" ;
266 listen STDIN, 2;
267 accept "fred", STDIN;
268 shutdown STDIN, 0;
269 setsockopt STDIN, 1,2,3;
270 getsockopt STDIN, 1,2;
271 getsockname STDIN;
272 getpeername STDIN;
273 opendir STDIN, ".";
274 send STDIN, "fred", 1;
275 bind STDIN, "fred" ;
276 connect STDIN, "fred" ;
277 listen STDIN, 2;
278 accept "fred", STDIN;
279 shutdown STDIN, 0;
280 setsockopt STDIN, 1,2,3;
281 getsockopt STDIN, 1,2;
282 getsockname STDIN;
283 getpeername STDIN;
284 closedir STDIN;
285 no warnings 'io' ;
286 send STDIN, "fred", 1;
287 bind STDIN, "fred" ;
288 connect STDIN, "fred" ;
289 listen STDIN, 2;
290 accept STDIN, "fred" ;
291 shutdown STDIN, 0;
292 setsockopt STDIN, 1,2,3;
293 getsockopt STDIN, 1,2;
294 getsockname STDIN;
295 getpeername STDIN;
296 opendir STDIN, ".";
297 send STDIN, "fred", 1;
298 bind STDIN, "fred" ;
299 connect STDIN, "fred" ;
300 listen STDIN, 2;
301 accept "fred", STDIN;
302 shutdown STDIN, 0;
303 setsockopt STDIN, 1,2,3;
304 getsockopt STDIN, 1,2;
305 getsockname STDIN;
306 getpeername STDIN;
307 EXPECT
308 send() on closed socket STDIN at - line 22.
309 bind() on closed socket STDIN at - line 23.
310 connect() on closed socket STDIN at - line 24.
311 listen() on closed socket STDIN at - line 25.
312 accept() on closed socket STDIN at - line 26.
313 shutdown() on closed socket STDIN at - line 27.
314 setsockopt() on closed socket STDIN at - line 28.
315 getsockopt() on closed socket STDIN at - line 29.
316 getsockname() on closed socket STDIN at - line 30.
317 getpeername() on closed socket STDIN at - line 31.
318 send() on closed socket STDIN at - line 33.
319         (Are you trying to call send() on dirhandle STDIN?)
320 bind() on closed socket STDIN at - line 34.
321         (Are you trying to call bind() on dirhandle STDIN?)
322 connect() on closed socket STDIN at - line 35.
323         (Are you trying to call connect() on dirhandle STDIN?)
324 listen() on closed socket STDIN at - line 36.
325         (Are you trying to call listen() on dirhandle STDIN?)
326 accept() on closed socket STDIN at - line 37.
327         (Are you trying to call accept() on dirhandle STDIN?)
328 shutdown() on closed socket STDIN at - line 38.
329         (Are you trying to call shutdown() on dirhandle STDIN?)
330 setsockopt() on closed socket STDIN at - line 39.
331         (Are you trying to call setsockopt() on dirhandle STDIN?)
332 getsockopt() on closed socket STDIN at - line 40.
333         (Are you trying to call getsockopt() on dirhandle STDIN?)
334 getsockname() on closed socket STDIN at - line 41.
335         (Are you trying to call getsockname() on dirhandle STDIN?)
336 getpeername() on closed socket STDIN at - line 42.
337         (Are you trying to call getpeername() on dirhandle STDIN?)
338 ########
339 # pp_sys.c [pp_stat]
340 use warnings 'newline' ;
341 stat "abc\ndef";
342 no warnings 'newline' ;
343 stat "abc\ndef";
344 EXPECT
345 Unsuccessful stat on filename containing newline at - line 3.
346 ########
347 # pp_sys.c [pp_fttext]
348 use warnings qw(unopened closed) ;
349 close STDIN ; 
350 -T STDIN ;
351 stat(STDIN) ;
352 -T HOCUS;
353 stat(POCUS);
354 no warnings qw(unopened closed) ;
355 -T STDIN ;
356 stat(STDIN);
357 -T HOCUS;
358 stat(POCUS);
359 EXPECT
360 -T on closed filehandle STDIN at - line 4.
361 stat() on closed filehandle STDIN at - line 5.
362 -T on unopened filehandle HOCUS at - line 6.
363 stat() on unopened filehandle POCUS at - line 7.
364 ########
365 # pp_sys.c [pp_fttext]
366 use warnings 'newline' ;
367 -T "abc\ndef" ;
368 no warnings 'newline' ;
369 -T "abc\ndef" ;
370 EXPECT
371 Unsuccessful open on filename containing newline at - line 3.
372 ########
373 # pp_sys.c [pp_sysread]
374 use warnings 'io' ;
375 if ($^O eq 'dos') {
376     print <<EOM ;
377 SKIPPED
378 # skipped on dos
379 EOM
380     exit ;
381 }
382 my $file = "./xcv" ;
383 open(F, ">$file") ; 
384 my $a = sysread(F, $a,10) ;
385 no warnings 'io' ;
386 my $a = sysread(F, $a,10) ;
387 close F ;
388 unlink $file ;
389 EXPECT
390 Filehandle F opened only for output at - line 12.
391 ########
392 # pp_sys.c [pp_binmode]
393 use warnings 'unopened' ;
394 binmode(BLARG);
395 $a = "BLERG";binmode($a);
396 EXPECT
397 binmode() on unopened filehandle BLARG at - line 3.
398 binmode() on unopened filehandle at - line 4.