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 |
38 | use warning 'unopened' ; |
39 | $f = $a = "abc" ; |
40 | print $f $a |
41 | EXPECT |
42 | Filehandle main::abc never opened at - line 4. |
43 | ######## |
44 | # pp_hot.c |
45 | use warning 'io' ; |
46 | print STDIN "anc"; |
af8c498a |
47 | print <STDOUT>; |
48 | print <STDERR>; |
49 | open(FOO, ">&STDOUT") and print <FOO>; |
50 | print getc(STDERR); |
51 | print getc(FOO); |
52 | read(FOO,$_,1); |
599cee73 |
53 | EXPECT |
54 | Filehandle main::STDIN opened only for input at - line 3. |
af8c498a |
55 | Filehandle main::STDOUT opened only for output at - line 4. |
56 | Filehandle main::STDERR opened only for output at - line 5. |
57 | Filehandle main::FOO opened only for output at - line 6. |
58 | Filehandle main::STDERR opened only for output at - line 7. |
59 | Filehandle main::FOO opened only for output at - line 8. |
60 | Filehandle main::FOO opened only for output at - line 9. |
599cee73 |
61 | ######## |
62 | # pp_hot.c |
63 | use warning 'closed' ; |
64 | close STDIN ; |
65 | print STDIN "anc"; |
66 | EXPECT |
67 | print on closed filehandle main::STDIN at - line 4. |
68 | ######## |
69 | # pp_hot.c |
70 | use warning 'uninitialized' ; |
71 | my $a = undef ; |
72 | my @b = @$a |
73 | EXPECT |
74 | Use of uninitialized value at - line 4. |
75 | ######## |
76 | # pp_hot.c |
77 | use warning 'uninitialized' ; |
78 | my $a = undef ; |
79 | my %b = %$a |
80 | EXPECT |
81 | Use of uninitialized value at - line 4. |
82 | ######## |
83 | # pp_hot.c |
84 | use warning 'unsafe' ; |
85 | my %X ; %X = (1,2,3) ; |
86 | EXPECT |
87 | Odd number of elements in hash assignment at - line 3. |
88 | ######## |
89 | # pp_hot.c |
90 | use warning 'unsafe' ; |
91 | my %X ; %X = [1 .. 3] ; |
92 | EXPECT |
93 | Reference found where even-sized list expected at - line 3. |
94 | ######## |
95 | # pp_hot.c |
96 | use warning 'closed' ; |
97 | close STDIN ; $a = <STDIN> ; |
98 | EXPECT |
af8c498a |
99 | Read on closed filehandle main::STDIN at - line 3. |
599cee73 |
100 | ######## |
101 | # pp_hot.c |
102 | use warning 'recursion' ; |
103 | sub fred |
104 | { |
105 | fred() if $a++ < 200 |
106 | } |
4a925ff6 |
107 | { |
108 | local $SIG{__WARN__} = sub { |
109 | die "ok\n" if $_[0] =~ /^Deep recursion on subroutine "main::fred"/ |
110 | }; |
111 | fred(); |
112 | } |
599cee73 |
113 | EXPECT |
4a925ff6 |
114 | ok |
599cee73 |
115 | ######## |
116 | # pp_hot.c |
117 | use warning 'recursion' ; |
118 | $b = sub |
119 | { |
120 | &$b if $a++ < 200 |
121 | } ; |
122 | |
123 | &$b ; |
124 | EXPECT |
125 | Deep recursion on anonymous subroutine at - line 5. |