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