source:
trunk/essentials/dev-lang/perl/t/lib/warnings/3both@
3951
| Last change on this file since 3951 was 3181, checked in by , 19 years ago | |
|---|---|
| File size: 4.0 KB | |
| Line | |
|---|---|
| 1 | Check interaction of $^W and lexical |
| 2 | |
| 3 | __END__ |
| 4 | |
| 5 | # Check interaction of $^W and use warnings |
| 6 | sub fred { |
| 7 | use warnings ; |
| 8 | my $b ; |
| 9 | chop $b ; |
| 10 | } |
| 11 | { local $^W = 0 ; |
| 12 | fred() ; |
| 13 | } |
| 14 | |
| 15 | EXPECT |
| 16 | Use of uninitialized value in scalar chop at - line 6. |
| 17 | ######## |
| 18 | |
| 19 | # Check interaction of $^W and use warnings |
| 20 | sub fred { |
| 21 | use warnings ; |
| 22 | my $b ; |
| 23 | chop $b ; |
| 24 | } |
| 25 | { $^W = 0 ; |
| 26 | fred() ; |
| 27 | } |
| 28 | |
| 29 | EXPECT |
| 30 | Use of uninitialized value in scalar chop at - line 6. |
| 31 | ######## |
| 32 | |
| 33 | # Check interaction of $^W and use warnings |
| 34 | sub fred { |
| 35 | no warnings ; |
| 36 | my $b ; |
| 37 | chop $b ; |
| 38 | } |
| 39 | { local $^W = 1 ; |
| 40 | fred() ; |
| 41 | } |
| 42 | |
| 43 | EXPECT |
| 44 | |
| 45 | ######## |
| 46 | |
| 47 | # Check interaction of $^W and use warnings |
| 48 | sub fred { |
| 49 | no warnings ; |
| 50 | my $b ; |
| 51 | chop $b ; |
| 52 | } |
| 53 | { $^W = 1 ; |
| 54 | fred() ; |
| 55 | } |
| 56 | |
| 57 | EXPECT |
| 58 | |
| 59 | ######## |
