00371031a4d379ee67531c4d64d4d9648a76261f
[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] <<TODO
16     $a = "fred";close("$a")
17
18   tell() on unopened filehandle         [Perl_do_tell]
19     $a = "fred";$a = tell($a)
20
21   seek() on unopened filehandle         [Perl_do_seek]
22     $a = "fred";$a = seek($a,1,1)
23
24   sysseek() on unopened 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 unopened 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 no warnings 'io' ;
110 close STDIN ;
111 tell(STDIN);
112 $a = seek(STDIN,1,1);
113 $a = sysseek(STDIN,1,1);
114 -x STDIN ;
115 stat(STDIN) ;
116 EXPECT
117 tell() on unopened filehandle at - line 4.
118 seek() on unopened filehandle at - line 5.
119 sysseek() on unopened filehandle at - line 6.
120 -x on unopened filehandle STDIN at - line 7.
121 stat() on unopened filehandle STDIN at - line 8.
122 ########
123 # doio.c [Perl_do_print]
124 use warnings 'uninitialized' ;
125 print $a ;
126 no warnings 'uninitialized' ;
127 print $b ;
128 EXPECT
129 Use of uninitialized value in print at - line 3.
130 ########
131 # doio.c [Perl_my_stat Perl_my_lstat]
132 use warnings 'io' ;
133 stat "ab\ncd";
134 lstat "ab\ncd";
135 no warnings 'io' ;
136 stat "ab\ncd";
137 lstat "ab\ncd";
138 EXPECT
139 Unsuccessful stat on filename containing newline at - line 3.
140 Unsuccessful stat on filename containing newline at - line 4.
141 ########
142 # doio.c [Perl_do_aexec5]
143 use warnings 'io' ;
144 exec "lskdjfalksdjfdjfkls","" ;
145 no warnings 'io' ;
146 exec "lskdjfalksdjfdjfkls","" ;
147 EXPECT
148 OPTION regex
149 Can't exec "lskdjfalksdjfdjfkls": .+
150 ########
151 # doio.c [Perl_do_exec3]
152 use warnings 'io' ;
153 exec "lskdjfalksdjfdjfkls", "abc" ;
154 no warnings 'io' ;
155 exec "lskdjfalksdjfdjfkls", "abc" ;
156 EXPECT
157 OPTION regex
158 Can't exec "lskdjfalksdjfdjfkls(:? abc)?": .+
159 ########
160 # doio.c [Perl_nextargv]
161 $^W = 0 ;
162 my $filename = "./temp.dir" ;
163 mkdir $filename, 0777 
164   or die "Cannot create directory $filename: $!\n" ;
165 {
166     local (@ARGV) = ($filename) ;
167     local ($^I) = "" ;
168     my $x = <> ;
169 }
170 {
171     no warnings 'inplace' ;
172     local (@ARGV) = ($filename) ;
173     local ($^I) = "" ;
174     my $x = <> ;
175 }
176 {
177     use warnings 'inplace' ;
178     local (@ARGV) = ($filename) ;
179     local ($^I) = "" ;
180     my $x = <> ;
181 }
182 rmdir $filename ;
183 EXPECT
184 Can't do inplace edit: ./temp.dir is not a regular file at - line 9.
185 Can't do inplace edit: ./temp.dir is not a regular file at - line 21.
186
187 ########
188 # doio.c [Perl_do_eof]
189 use warnings 'io' ;
190 my $a = eof STDOUT ;
191 no warnings 'io' ;
192 $a = eof STDOUT ;
193 EXPECT
194 Filehandle STDOUT opened only for output at - line 3.