SYN SYN
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / doio
CommitLineData
c529f79d 1 doio.c
599cee73 2
146174a9 3 Can't open bidirectional pipe [Perl_do_open9]
599cee73 4 open(F, "| true |");
5
c529f79d 6 Missing command in piped open [Perl_do_open9]
06eaf0bc 7 open(F, "| ");
8
c529f79d 9 Missing command in piped open [Perl_do_open9]
06eaf0bc 10 open(F, " |");
11
c529f79d 12 warn(warn_nl, "open"); [Perl_do_open9]
599cee73 13 open(F, "true\ncd")
14
22d4bb9c 15 close() on unopened filehandle %s [Perl_do_close]
c529f79d 16 $a = "fred";close("$a")
599cee73 17
22d4bb9c 18 tell() on closed filehandle [Perl_do_tell]
599cee73 19 $a = "fred";$a = tell($a)
20
22d4bb9c 21 seek() on closed filehandle [Perl_do_seek]
599cee73 22 $a = "fred";$a = seek($a,1,1)
23
22d4bb9c 24 sysseek() on closed filehandle [Perl_do_sysseek]
599cee73 25 $a = "fred";$a = seek($a,1,1)
26
c529f79d 27 warn(warn_uninit); [Perl_do_print]
599cee73 28 print $a ;
29
22d4bb9c 30 -x on closed filehandle %s [Perl_my_stat]
599cee73 31 close STDIN ; -x STDIN ;
32
c529f79d 33 warn(warn_nl, "stat"); [Perl_my_stat]
599cee73 34 stat "ab\ncd"
35
c529f79d 36 warn(warn_nl, "lstat"); [Perl_my_lstat]
599cee73 37 lstat "ab\ncd"
38
c529f79d 39 Can't exec \"%s\": %s [Perl_do_aexec5]
599cee73 40
c529f79d 41 Can't exec \"%s\": %s [Perl_do_exec3]
599cee73 42
c529f79d 43 Filehandle %s opened only for output [Perl_do_eof]
44 my $a = eof STDOUT
599cee73 45
0453d815 46 Mandatory Warnings ALL TODO
47 ------------------
c529f79d 48 Can't do inplace edit: %s is not a regular file [Perl_nextargv]
0453d815 49 edit a directory
50
c529f79d 51 Can't do inplace edit: %s would not be unique [Perl_nextargv]
52 Can't rename %s to %s: %s, skipping file [Perl_nextargv]
53 Can't rename %s to %s: %s, skipping file [Perl_nextargv]
54 Can't remove %s: %s, skipping file [Perl_nextargv]
55 Can't do inplace edit on %s: %s [Perl_nextargv]
0453d815 56
57
599cee73 58__END__
c529f79d 59# doio.c [Perl_do_open9]
4438c4b7 60use warnings 'io' ;
3eeba6fb 61open(F, '|'.($^O eq 'VMS' ? 'mcr ':'')."$^X -e 1|");
62close(F);
4438c4b7 63no warnings 'io' ;
0453d815 64open(G, '|'.($^O eq 'VMS' ? 'mcr ':'')."$^X -e 1|");
65close(G);
599cee73 66EXPECT
146174a9 67Can't open bidirectional pipe at - line 3.
599cee73 68########
c529f79d 69# doio.c [Perl_do_open9]
4438c4b7 70use warnings 'io' ;
0453d815 71open(F, "| ");
4438c4b7 72no warnings 'io' ;
0453d815 73open(G, "| ");
06eaf0bc 74EXPECT
75Missing command in piped open at - line 3.
76########
c529f79d 77# doio.c [Perl_do_open9]
4438c4b7 78use warnings 'io' ;
0453d815 79open(F, " |");
4438c4b7 80no warnings 'io' ;
0453d815 81open(G, " |");
06eaf0bc 82EXPECT
83Missing command in piped open at - line 3.
84########
c529f79d 85# doio.c [Perl_do_open9]
4438c4b7 86use warnings 'io' ;
0453d815 87open(F, "<true\ncd");
4438c4b7 88no warnings 'io' ;
0453d815 89open(G, "<true\ncd");
599cee73 90EXPECT
91Unsuccessful open on filename containing newline at - line 3.
92########
c529f79d 93# doio.c [Perl_do_close] <<TODO
94use warnings 'unopened' ;
95close "fred" ;
96no warnings 'unopened' ;
97close "joe" ;
98EXPECT
22d4bb9c 99close() on unopened filehandle fred at - line 3.
c529f79d 100########
101# doio.c [Perl_do_tell Perl_do_seek Perl_do_sysseek Perl_my_stat]
4438c4b7 102use warnings 'io' ;
599cee73 103close STDIN ;
104tell(STDIN);
105$a = seek(STDIN,1,1);
106$a = sysseek(STDIN,1,1);
107-x STDIN ;
22d4bb9c 108stat(STDIN) ;
109$a = "fred";
110tell($a);
111seek($a,1,1);
112sysseek($a,1,1);
113-x $a; # ok
114stat($a); # ok
4438c4b7 115no warnings 'io' ;
0453d815 116close STDIN ;
117tell(STDIN);
118$a = seek(STDIN,1,1);
119$a = sysseek(STDIN,1,1);
120-x STDIN ;
22d4bb9c 121stat(STDIN) ;
122$a = "fred";
123tell($a);
124seek($a,1,1);
125sysseek($a,1,1);
126-x $a;
127stat($a);
599cee73 128EXPECT
22d4bb9c 129tell() on closed filehandle STDIN at - line 4.
130seek() on closed filehandle STDIN at - line 5.
131sysseek() on closed filehandle STDIN at - line 6.
132-x on closed filehandle STDIN at - line 7.
133stat() on closed filehandle STDIN at - line 8.
134tell() on unopened filehandle at - line 10.
135seek() on unopened filehandle at - line 11.
136sysseek() on unopened filehandle at - line 12.
599cee73 137########
c529f79d 138# doio.c [Perl_do_print]
4438c4b7 139use warnings 'uninitialized' ;
599cee73 140print $a ;
4438c4b7 141no warnings 'uninitialized' ;
0453d815 142print $b ;
599cee73 143EXPECT
146174a9 144Use of uninitialized value in print at - line 3.
599cee73 145########
c529f79d 146# doio.c [Perl_my_stat Perl_my_lstat]
4438c4b7 147use warnings 'io' ;
599cee73 148stat "ab\ncd";
149lstat "ab\ncd";
4438c4b7 150no warnings 'io' ;
0453d815 151stat "ab\ncd";
152lstat "ab\ncd";
599cee73 153EXPECT
154Unsuccessful stat on filename containing newline at - line 3.
155Unsuccessful stat on filename containing newline at - line 4.
156########
c529f79d 157# doio.c [Perl_do_aexec5]
4438c4b7 158use warnings 'io' ;
dfe13c55 159exec "lskdjfalksdjfdjfkls","" ;
4438c4b7 160no warnings 'io' ;
0453d815 161exec "lskdjfalksdjfdjfkls","" ;
599cee73 162EXPECT
e5e1b98b 163OPTION regex
c4f6c246 164Can't exec "lskdjfalksdjfdjfkls": .+
599cee73 165########
c529f79d 166# doio.c [Perl_do_exec3]
4438c4b7 167use warnings 'io' ;
599cee73 168exec "lskdjfalksdjfdjfkls", "abc" ;
4438c4b7 169no warnings 'io' ;
0453d815 170exec "lskdjfalksdjfdjfkls", "abc" ;
599cee73 171EXPECT
e5e1b98b 172OPTION regex
3eeba6fb 173Can't exec "lskdjfalksdjfdjfkls(:? abc)?": .+
0453d815 174########
c529f79d 175# doio.c [Perl_nextargv]
0453d815 176$^W = 0 ;
8b164fe9 177my $filename = "./temp.dir" ;
0453d815 178mkdir $filename, 0777
179 or die "Cannot create directory $filename: $!\n" ;
180{
181 local (@ARGV) = ($filename) ;
182 local ($^I) = "" ;
183 my $x = <> ;
184}
185{
4438c4b7 186 no warnings 'inplace' ;
0453d815 187 local (@ARGV) = ($filename) ;
188 local ($^I) = "" ;
189 my $x = <> ;
190}
191{
4438c4b7 192 use warnings 'inplace' ;
0453d815 193 local (@ARGV) = ($filename) ;
194 local ($^I) = "" ;
195 my $x = <> ;
196}
197rmdir $filename ;
198EXPECT
8b164fe9 199Can't do inplace edit: ./temp.dir is not a regular file at - line 9.
200Can't do inplace edit: ./temp.dir is not a regular file at - line 21.
0453d815 201
c529f79d 202########
203# doio.c [Perl_do_eof]
204use warnings 'io' ;
205my $a = eof STDOUT ;
206no warnings 'io' ;
207$a = eof STDOUT ;
208EXPECT
4b19af01 209Filehandle STDOUT opened only for output at - line 3.