Commit | Line | Data |
767a6a26 |
1 | pp_hot.c |
599cee73 |
2 | |
2dd78f96 |
3 | print() on unopened filehandle abc [pp_print] |
599cee73 |
4 | $f = $a = "abc" ; print $f $a |
5 | |
767a6a26 |
6 | Filehandle %s opened only for input [pp_print] |
599cee73 |
7 | print STDIN "abc" ; |
8 | |
767a6a26 |
9 | Filehandle %s opened only for output [pp_print] |
af8c498a |
10 | print <STDOUT> ; |
599cee73 |
11 | |
9a7dcd9c |
12 | print() on closed filehandle %s [pp_print] |
599cee73 |
13 | close STDIN ; print STDIN "abc" ; |
14 | |
767a6a26 |
15 | uninitialized [pp_rv2av] |
599cee73 |
16 | my $a = undef ; my @b = @$a |
17 | |
767a6a26 |
18 | uninitialized [pp_rv2hv] |
599cee73 |
19 | my $a = undef ; my %b = %$a |
20 | |
767a6a26 |
21 | Odd number of elements in hash list [pp_aassign] |
599cee73 |
22 | %X = (1,2,3) ; |
23 | |
767a6a26 |
24 | Reference found where even-sized list expected [pp_aassign] |
599cee73 |
25 | $X = [ 1 ..3 ]; |
26 | |
767a6a26 |
27 | Filehandle %s opened only for output [Perl_do_readline] |
28 | open (FH, ">./xcv") ; |
29 | my $a = <FH> ; |
30 | |
31 | glob failed (can't start child: %s) [Perl_do_readline] <<TODO |
32 | |
9a7dcd9c |
33 | readline() on closed filehandle %s [Perl_do_readline] |
599cee73 |
34 | close STDIN ; $a = <STDIN>; |
35 | |
790090df |
36 | readline() on closed filehandle %s [Perl_do_readline] |
37 | readline(NONESUCH); |
38 | |
767a6a26 |
39 | glob failed (child exited with status %d%s) [Perl_do_readline] <<TODO |
40 | |
41 | Deep recursion on subroutine \"%s\" [Perl_sub_crush_depth] |
6bc102ca |
42 | sub fred { fred() if $a++ < 200} fred() |
599cee73 |
43 | |
767a6a26 |
44 | Deep recursion on anonymous subroutine [Perl_sub_crush_depth] |
6bc102ca |
45 | $a = sub { &$a if $a++ < 200} &$a |
599cee73 |
46 | |
6bc102ca |
47 | Possible Y2K bug: about to append an integer to '19' [pp_concat] |
48 | $x = "19$yy\n"; |
767a6a26 |
49 | |
599cee73 |
50 | __END__ |
767a6a26 |
51 | # pp_hot.c [pp_print] |
4438c4b7 |
52 | use warnings 'unopened' ; |
599cee73 |
53 | $f = $a = "abc" ; |
0453d815 |
54 | print $f $a; |
4438c4b7 |
55 | no warnings 'unopened' ; |
0453d815 |
56 | print $f $a; |
599cee73 |
57 | EXPECT |
2dd78f96 |
58 | print() on unopened filehandle abc at - line 4. |
599cee73 |
59 | ######## |
767a6a26 |
60 | # pp_hot.c [pp_print] |
4438c4b7 |
61 | use warnings 'io' ; |
599cee73 |
62 | print STDIN "anc"; |
af8c498a |
63 | print <STDOUT>; |
64 | print <STDERR>; |
65 | open(FOO, ">&STDOUT") and print <FOO>; |
66 | print getc(STDERR); |
67 | print getc(FOO); |
ea1135d6 |
68 | #################################################################### |
69 | # The next test is known to fail on some systems (Linux+old glibc, # |
70 | # old *BSDs, and NeXT, among others. # |
71 | # We skip it for now (on the grounds that it is "just" a warning). # |
72 | #################################################################### |
37bd1396 |
73 | #read(FOO,$_,1); |
74 | no warnings 'io' ; |
75 | print STDIN "anc"; |
599cee73 |
76 | EXPECT |
43693395 |
77 | Filehandle STDIN opened only for input at - line 3. |
78 | Filehandle STDOUT opened only for output at - line 4. |
79 | Filehandle STDERR opened only for output at - line 5. |
80 | Filehandle FOO opened only for output at - line 6. |
81 | Filehandle STDERR opened only for output at - line 7. |
82 | Filehandle FOO opened only for output at - line 8. |
599cee73 |
83 | ######## |
767a6a26 |
84 | # pp_hot.c [pp_print] |
4438c4b7 |
85 | use warnings 'closed' ; |
599cee73 |
86 | close STDIN ; |
87 | print STDIN "anc"; |
69282e91 |
88 | opendir STDIN, "."; |
89 | print STDIN "anc"; |
90 | closedir STDIN; |
4438c4b7 |
91 | no warnings 'closed' ; |
0453d815 |
92 | print STDIN "anc"; |
69282e91 |
93 | opendir STDIN, "."; |
94 | print STDIN "anc"; |
599cee73 |
95 | EXPECT |
43693395 |
96 | print() on closed filehandle STDIN at - line 4. |
97 | print() on closed filehandle STDIN at - line 6. |
98 | (Are you trying to call print() on dirhandle STDIN?) |
599cee73 |
99 | ######## |
767a6a26 |
100 | # pp_hot.c [pp_rv2av] |
4438c4b7 |
101 | use warnings 'uninitialized' ; |
599cee73 |
102 | my $a = undef ; |
0453d815 |
103 | my @b = @$a; |
4438c4b7 |
104 | no warnings 'uninitialized' ; |
0453d815 |
105 | my @c = @$a; |
599cee73 |
106 | EXPECT |
b89fed5f |
107 | Use of uninitialized value in array dereference at - line 4. |
599cee73 |
108 | ######## |
767a6a26 |
109 | # pp_hot.c [pp_rv2hv] |
4438c4b7 |
110 | use warnings 'uninitialized' ; |
599cee73 |
111 | my $a = undef ; |
0453d815 |
112 | my %b = %$a; |
4438c4b7 |
113 | no warnings 'uninitialized' ; |
0453d815 |
114 | my %c = %$a; |
599cee73 |
115 | EXPECT |
b89fed5f |
116 | Use of uninitialized value in hash dereference at - line 4. |
599cee73 |
117 | ######## |
767a6a26 |
118 | # pp_hot.c [pp_aassign] |
e476b1b5 |
119 | use warnings 'misc' ; |
599cee73 |
120 | my %X ; %X = (1,2,3) ; |
e476b1b5 |
121 | no warnings 'misc' ; |
0453d815 |
122 | my %Y ; %Y = (1,2,3) ; |
599cee73 |
123 | EXPECT |
124 | Odd number of elements in hash assignment at - line 3. |
125 | ######## |
767a6a26 |
126 | # pp_hot.c [pp_aassign] |
e476b1b5 |
127 | use warnings 'misc' ; |
599cee73 |
128 | my %X ; %X = [1 .. 3] ; |
e476b1b5 |
129 | no warnings 'misc' ; |
0453d815 |
130 | my %Y ; %Y = [1 .. 3] ; |
599cee73 |
131 | EXPECT |
132 | Reference found where even-sized list expected at - line 3. |
133 | ######## |
767a6a26 |
134 | # pp_hot.c [Perl_do_readline] |
4438c4b7 |
135 | use warnings 'closed' ; |
69282e91 |
136 | close STDIN ; $a = <STDIN> ; |
137 | opendir STDIN, "." ; $a = <STDIN> ; |
138 | closedir STDIN; |
4438c4b7 |
139 | no warnings 'closed' ; |
69282e91 |
140 | opendir STDIN, "." ; $a = <STDIN> ; |
0453d815 |
141 | $a = <STDIN> ; |
599cee73 |
142 | EXPECT |
43693395 |
143 | readline() on closed filehandle STDIN at - line 3. |
144 | readline() on closed filehandle STDIN at - line 4. |
145 | (Are you trying to call readline() on dirhandle STDIN?) |
599cee73 |
146 | ######## |
767a6a26 |
147 | # pp_hot.c [Perl_do_readline] |
148 | use warnings 'io' ; |
149 | my $file = "./xcv" ; unlink $file ; |
150 | open (FH, ">./xcv") ; |
151 | my $a = <FH> ; |
152 | no warnings 'io' ; |
153 | $a = <FH> ; |
154 | unlink $file ; |
155 | EXPECT |
43693395 |
156 | Filehandle FH opened only for output at - line 5. |
767a6a26 |
157 | ######## |
158 | # pp_hot.c [Perl_sub_crush_depth] |
4438c4b7 |
159 | use warnings 'recursion' ; |
599cee73 |
160 | sub fred |
161 | { |
162 | fred() if $a++ < 200 |
163 | } |
4a925ff6 |
164 | { |
165 | local $SIG{__WARN__} = sub { |
166 | die "ok\n" if $_[0] =~ /^Deep recursion on subroutine "main::fred"/ |
167 | }; |
168 | fred(); |
169 | } |
599cee73 |
170 | EXPECT |
4a925ff6 |
171 | ok |
599cee73 |
172 | ######## |
767a6a26 |
173 | # pp_hot.c [Perl_sub_crush_depth] |
4438c4b7 |
174 | no warnings 'recursion' ; |
0453d815 |
175 | sub fred |
176 | { |
177 | fred() if $a++ < 200 |
178 | } |
179 | { |
180 | local $SIG{__WARN__} = sub { |
181 | die "ok\n" if $_[0] =~ /^Deep recursion on subroutine "main::fred"/ |
182 | }; |
183 | fred(); |
184 | } |
185 | EXPECT |
186 | |
187 | ######## |
767a6a26 |
188 | # pp_hot.c [Perl_sub_crush_depth] |
4438c4b7 |
189 | use warnings 'recursion' ; |
599cee73 |
190 | $b = sub |
191 | { |
192 | &$b if $a++ < 200 |
193 | } ; |
194 | |
195 | &$b ; |
196 | EXPECT |
197 | Deep recursion on anonymous subroutine at - line 5. |
0453d815 |
198 | ######## |
767a6a26 |
199 | # pp_hot.c [Perl_sub_crush_depth] |
4438c4b7 |
200 | no warnings 'recursion' ; |
0453d815 |
201 | $b = sub |
202 | { |
203 | &$b if $a++ < 200 |
204 | } ; |
205 | |
206 | &$b ; |
207 | EXPECT |
6bc102ca |
208 | ######## |
209 | # pp_hot.c [pp_concat] |
e476b1b5 |
210 | use warnings 'y2k'; |
6bc102ca |
211 | use Config; |
212 | BEGIN { |
213 | unless ($Config{ccflags} =~ /Y2KWARN/) { |
214 | print "SKIPPED\n# perl not built with -DPERL_Y2KWARN"; |
215 | exit 0; |
216 | } |
217 | } |
218 | my $x; |
219 | my $yy = 78; |
220 | $x = "19$yy\n"; |
221 | $x = "19" . $yy . "\n"; |
222 | $x = "319$yy\n"; |
223 | $x = "319" . $yy . "\n"; |
e476b1b5 |
224 | no warnings 'y2k'; |
6bc102ca |
225 | $x = "19$yy\n"; |
226 | $x = "19" . $yy . "\n"; |
227 | EXPECT |
228 | Possible Y2K bug: about to append an integer to '19' at - line 12. |
229 | Possible Y2K bug: about to append an integer to '19' at - line 13. |