Commit | Line | Data |
599cee73 |
1 | pp_hot.c AOK |
2 | |
3 | Filehandle %s never opened |
4 | $f = $a = "abc" ; print $f $a |
5 | |
6 | Filehandle %s opened only for input |
7 | print STDIN "abc" ; |
8 | |
af8c498a |
9 | Filehandle %s opened only for output |
10 | print <STDOUT> ; |
599cee73 |
11 | |
12 | print on closed filehandle %s |
13 | close STDIN ; print STDIN "abc" ; |
14 | |
15 | uninitialized |
16 | my $a = undef ; my @b = @$a |
17 | |
18 | uninitialized |
19 | my $a = undef ; my %b = %$a |
20 | |
21 | Odd number of elements in hash list |
22 | %X = (1,2,3) ; |
23 | |
24 | Reference found where even-sized list expected |
25 | $X = [ 1 ..3 ]; |
26 | |
af8c498a |
27 | Read on closed filehandle %s |
599cee73 |
28 | close STDIN ; $a = <STDIN>; |
29 | |
30 | Deep recursion on subroutine \"%s\" |
31 | sub fred { fred() if $a++ < 200} fred() |
32 | |
33 | Deep recursion on anonymous subroutine |
34 | $a = sub { &$a if $a++ < 200} &$a |
35 | |
36 | __END__ |
37 | # pp_hot.c |
4438c4b7 |
38 | use warnings 'unopened' ; |
599cee73 |
39 | $f = $a = "abc" ; |
0453d815 |
40 | print $f $a; |
4438c4b7 |
41 | no warnings 'unopened' ; |
0453d815 |
42 | print $f $a; |
599cee73 |
43 | EXPECT |
44 | Filehandle main::abc never opened at - line 4. |
45 | ######## |
46 | # pp_hot.c |
4438c4b7 |
47 | use warnings 'io' ; |
599cee73 |
48 | print STDIN "anc"; |
af8c498a |
49 | print <STDOUT>; |
50 | print <STDERR>; |
51 | open(FOO, ">&STDOUT") and print <FOO>; |
52 | print getc(STDERR); |
53 | print getc(FOO); |
88c07c36 |
54 | #################################################################### |
37bd1396 |
55 | # The next test is known to fail on some systems (Linux/BSD+glibc, # |
56 | # NeXT among others. glibc should be fixed in the next version, # |
57 | # but it appears other platforms have little hope. We skip it for # |
58 | # now (on the grounds that it is "just" a warning). # |
88c07c36 |
59 | #################################################################### |
37bd1396 |
60 | #read(FOO,$_,1); |
61 | no warnings 'io' ; |
62 | print STDIN "anc"; |
599cee73 |
63 | EXPECT |
64 | Filehandle main::STDIN opened only for input at - line 3. |
af8c498a |
65 | Filehandle main::STDOUT opened only for output at - line 4. |
66 | Filehandle main::STDERR opened only for output at - line 5. |
67 | Filehandle main::FOO opened only for output at - line 6. |
68 | Filehandle main::STDERR opened only for output at - line 7. |
69 | Filehandle main::FOO opened only for output at - line 8. |
599cee73 |
70 | ######## |
71 | # pp_hot.c |
4438c4b7 |
72 | use warnings 'closed' ; |
599cee73 |
73 | close STDIN ; |
74 | print STDIN "anc"; |
4438c4b7 |
75 | no warnings 'closed' ; |
0453d815 |
76 | print STDIN "anc"; |
599cee73 |
77 | EXPECT |
78 | print on closed filehandle main::STDIN at - line 4. |
79 | ######## |
80 | # pp_hot.c |
4438c4b7 |
81 | use warnings 'uninitialized' ; |
599cee73 |
82 | my $a = undef ; |
0453d815 |
83 | my @b = @$a; |
4438c4b7 |
84 | no warnings 'uninitialized' ; |
0453d815 |
85 | my @c = @$a; |
599cee73 |
86 | EXPECT |
87 | Use of uninitialized value at - line 4. |
88 | ######## |
89 | # pp_hot.c |
4438c4b7 |
90 | use warnings 'uninitialized' ; |
599cee73 |
91 | my $a = undef ; |
0453d815 |
92 | my %b = %$a; |
4438c4b7 |
93 | no warnings 'uninitialized' ; |
0453d815 |
94 | my %c = %$a; |
599cee73 |
95 | EXPECT |
96 | Use of uninitialized value at - line 4. |
97 | ######## |
98 | # pp_hot.c |
4438c4b7 |
99 | use warnings 'unsafe' ; |
599cee73 |
100 | my %X ; %X = (1,2,3) ; |
4438c4b7 |
101 | no warnings 'unsafe' ; |
0453d815 |
102 | my %Y ; %Y = (1,2,3) ; |
599cee73 |
103 | EXPECT |
104 | Odd number of elements in hash assignment at - line 3. |
105 | ######## |
106 | # pp_hot.c |
4438c4b7 |
107 | use warnings 'unsafe' ; |
599cee73 |
108 | my %X ; %X = [1 .. 3] ; |
4438c4b7 |
109 | no warnings 'unsafe' ; |
0453d815 |
110 | my %Y ; %Y = [1 .. 3] ; |
599cee73 |
111 | EXPECT |
112 | Reference found where even-sized list expected at - line 3. |
113 | ######## |
114 | # pp_hot.c |
4438c4b7 |
115 | use warnings 'closed' ; |
599cee73 |
116 | close STDIN ; $a = <STDIN> ; |
4438c4b7 |
117 | no warnings 'closed' ; |
0453d815 |
118 | $a = <STDIN> ; |
599cee73 |
119 | EXPECT |
af8c498a |
120 | Read on closed filehandle main::STDIN at - line 3. |
599cee73 |
121 | ######## |
122 | # pp_hot.c |
4438c4b7 |
123 | use warnings 'recursion' ; |
599cee73 |
124 | sub fred |
125 | { |
126 | fred() if $a++ < 200 |
127 | } |
4a925ff6 |
128 | { |
129 | local $SIG{__WARN__} = sub { |
130 | die "ok\n" if $_[0] =~ /^Deep recursion on subroutine "main::fred"/ |
131 | }; |
132 | fred(); |
133 | } |
599cee73 |
134 | EXPECT |
4a925ff6 |
135 | ok |
599cee73 |
136 | ######## |
137 | # pp_hot.c |
4438c4b7 |
138 | no warnings 'recursion' ; |
0453d815 |
139 | sub fred |
140 | { |
141 | fred() if $a++ < 200 |
142 | } |
143 | { |
144 | local $SIG{__WARN__} = sub { |
145 | die "ok\n" if $_[0] =~ /^Deep recursion on subroutine "main::fred"/ |
146 | }; |
147 | fred(); |
148 | } |
149 | EXPECT |
150 | |
151 | ######## |
152 | # pp_hot.c |
4438c4b7 |
153 | use warnings 'recursion' ; |
599cee73 |
154 | $b = sub |
155 | { |
156 | &$b if $a++ < 200 |
157 | } ; |
158 | |
159 | &$b ; |
160 | EXPECT |
161 | Deep recursion on anonymous subroutine at - line 5. |
0453d815 |
162 | ######## |
163 | # pp_hot.c |
4438c4b7 |
164 | no warnings 'recursion' ; |
0453d815 |
165 | $b = sub |
166 | { |
167 | &$b if $a++ < 200 |
168 | } ; |
169 | |
170 | &$b ; |
171 | EXPECT |
172 | |