1Check lint 2 3__END__ 4-W 5# lint: check compile time $^W is zapped 6BEGIN { $^W = 0 ;} 7$a = 1 ; 8$a =+ 1 ; 9close STDIN ; print STDIN "abc" ; 10EXPECT 11Reversed += operator at - line 5. 12print() on closed filehandle STDIN at - line 6. 13######## 14-W 15# lint: check runtime $^W is zapped 16$^W = 0 ; 17close STDIN ; print STDIN "abc" ; 18EXPECT 19print() on closed filehandle STDIN at - line 4. 20######## 21-W 22# lint: check runtime $^W is zapped 23{ 24 $^W = 0 ; 25 close STDIN ; print STDIN "abc" ; 26} 27EXPECT 28print() on closed filehandle STDIN at - line 5. 29######## 30-W 31# lint: check "no warnings" is zapped 32no warnings ; 33$a = 1 ; 34$a =+ 1 ; 35close STDIN ; print STDIN "abc" ; 36EXPECT 37Reversed += operator at - line 5. 38print() on closed filehandle STDIN at - line 6. 39######## 40-W 41# lint: check "no warnings" is zapped 42{ 43 no warnings ; 44 close STDIN ; print STDIN "abc" ; 45} 46EXPECT 47print() on closed filehandle STDIN at - line 5. 48######## 49-Ww 50# lint: check combination of -w and -W 51{ 52 $^W = 0 ; 53 close STDIN ; print STDIN "abc" ; 54} 55EXPECT 56print() on closed filehandle STDIN at - line 5. 57######## 58-W 59--FILE-- abc.pm 60package abc; 61no warnings 'syntax' ; 62my $a = 0; 63$a =+ 1 ; 641; 65--FILE-- 66no warnings 'uninitialized' ; 67use abc; 68my $a ; chop $a ; 69EXPECT 70Reversed += operator at abc.pm line 4. 71Use of uninitialized value $a in scalar chop at - line 3. 72######## 73-W 74--FILE-- abc 75package abc; 76no warnings 'syntax' ; 77my $a = 0; 78$a =+ 1 ; 791; 80--FILE-- 81no warnings 'uninitialized' ; 82require "./abc"; 83my $a ; chop $a ; 84EXPECT 85Reversed += operator at ./abc line 4. 86Use of uninitialized value $a in scalar chop at - line 3. 87######## 88-W 89--FILE-- abc.pm 90package abc; 91BEGIN {$^W = 0} 92my $a = 0 ; 93$a =+ 1 ; 941; 95--FILE-- 96$^W = 0 ; 97use abc; 98my $a ; chop $a ; 99EXPECT 100Reversed += operator at abc.pm line 4. 101Use of uninitialized value $a in scalar chop at - line 3. 102######## 103-W 104--FILE-- abc 105BEGIN {$^W = 0} 106my $a = 0 ; 107$a =+ 1 ; 1081; 109--FILE-- 110$^W = 0 ; 111require "./abc"; 112my $a ; chop $a ; 113EXPECT 114Reversed += operator at ./abc line 3. 115Use of uninitialized value $a in scalar chop at - line 3. 116######## 117-W 118# Check scope of pragma with eval 119{ 120 no warnings ; 121 eval ' 122 my $b ; chop $b ; 123 '; print STDERR $@ ; 124 my $b ; chop $b ; 125} 126EXPECT 127Use of uninitialized value $b in scalar chop at (eval 1) line 2. 128Use of uninitialized value $b in scalar chop at - line 8. 129######## 130-W 131# Check scope of pragma with eval 132use warnings; 133{ 134 no warnings ; 135 eval q[ 136 use warnings 'uninitialized' ; 137 my $b ; chop $b ; 138 ]; print STDERR $@; 139 my $b ; chop $b ; 140} 141EXPECT 142Use of uninitialized value $b in scalar chop at (eval 1) line 3. 143Use of uninitialized value $b in scalar chop at - line 10. 144######## 145-W 146# Check scope of pragma with eval 147no warnings; 148{ 149 use warnings 'uninitialized' ; 150 eval ' 151 my $b ; chop $b ; 152 '; print STDERR $@ ; 153 my $b ; chop $b ; 154} 155EXPECT 156Use of uninitialized value $b in scalar chop at (eval 1) line 2. 157Use of uninitialized value $b in scalar chop at - line 9. 158######## 159-W 160# Check scope of pragma with eval 161no warnings; 162{ 163 use warnings 'uninitialized' ; 164 eval ' 165 no warnings ; 166 my $b ; chop $b ; 167 '; print STDERR $@ ; 168 my $b ; chop $b ; 169} 170EXPECT 171Use of uninitialized value $b in scalar chop at (eval 1) line 3. 172Use of uninitialized value $b in scalar chop at - line 10. 173######## 174-W 175# Check scope of pragma with eval 176use warnings; 177{ 178 my $a = "1"; my $b = "2"; 179 no warnings ; 180 eval q[ 181 use warnings 'syntax' ; 182 $a =+ 1 ; 183 ]; print STDERR $@; 184 $a =+ 1 ; 185} 186EXPECT 187Reversed += operator at - line 11. 188Reversed += operator at (eval 1) line 3. 189######## 190-W 191# Check scope of pragma with eval 192no warnings; 193{ 194 my $a = "1"; my $b = "2"; 195 use warnings 'syntax' ; 196 eval ' 197 $a =+ 1 ; 198 '; print STDERR $@; 199 $a =+ 1 ; 200} 201EXPECT 202Reversed += operator at - line 10. 203Reversed += operator at (eval 1) line 2. 204######## 205-W 206# Check scope of pragma with eval 207no warnings; 208{ 209 my $a = "1"; my $b = "2"; 210 use warnings 'syntax' ; 211 eval ' 212 no warnings ; 213 $a =+ 1 ; 214 '; print STDERR $@; 215 $a =+ 1 ; 216} 217EXPECT 218Reversed += operator at - line 11. 219Reversed += operator at (eval 1) line 3. 220