diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-11-21 13:02:47 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-11-21 13:02:47 -0800 |
commit | efcf35c4ce9be7ae046664523cf99dac85257e4a (patch) | |
tree | 18f909afe9e245232f87255669fc76a8314c9af7 /t | |
parent | f965e9d4a373e14022c83f58715a948ea40a9b4a (diff) | |
download | perl-efcf35c4ce9be7ae046664523cf99dac85257e4a.tar.gz |
Make constant sub redef warnings obey scope
In perldiag, this is listed as (S), which means that outside of any
use/no warnings scope it always warns, regardless of $^W.
But this warning was ignoring use/no warnings, too.
There were actually tests for this oddity, but I think those were
added by mistake, or this was just not thought through. I cannot see
how this is not a bug.
Diffstat (limited to 't')
-rw-r--r-- | t/lib/warnings/op | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/t/lib/warnings/op b/t/lib/warnings/op index 1a1bb26b7f..6c1f1f1a6f 100644 --- a/t/lib/warnings/op +++ b/t/lib/warnings/op @@ -732,18 +732,28 @@ EXPECT Constant subroutine fred redefined at - line 4. ######## # op.c +sub fred () { 1 } +sub fred () { 2 } +EXPECT +Constant subroutine fred redefined at - line 3. +######## +# op.c +sub fred () { 1 } +*fred = sub () { 2 }; +EXPECT +Constant subroutine main::fred redefined at - line 3. +######## +# op.c no warnings 'redefine' ; sub fred () { 1 } sub fred () { 2 } EXPECT -Constant subroutine fred redefined at - line 4. ######## # op.c no warnings 'redefine' ; sub fred () { 1 } *fred = sub () { 2 }; EXPECT -Constant subroutine main::fred redefined at - line 4. ######## # op.c use warnings 'redefine' ; @@ -1240,22 +1250,20 @@ EXPECT Constant subroutine frèd redefined at - line 6. ######## # op.c -no warnings 'redefine' ; use utf8; use open qw( :utf8 :std ); sub frèd () { 1 } sub frèd () { 2 } EXPECT -Constant subroutine frèd redefined at - line 6. +Constant subroutine frèd redefined at - line 5. ######## # op.c -no warnings 'redefine' ; use utf8; use open qw( :utf8 :std ); sub frèd () { 1 } *frèd = sub () { 2 }; EXPECT -Constant subroutine main::frèd redefined at - line 6. +Constant subroutine main::frèd redefined at - line 5. ######## # op.c use warnings 'redefine' ; @@ -1280,20 +1288,18 @@ EXPECT Constant subroutine ᚠርƊ redefined at - line 6. ######## # op.c -no warnings 'redefine' ; use utf8; use open qw( :utf8 :std ); sub ᚠርƊ () { 1 } sub ᚠርƊ () { 2 } EXPECT -Constant subroutine ᚠርƊ redefined at - line 6. +Constant subroutine ᚠርƊ redefined at - line 5. ######## # op.c -no warnings 'redefine' ; use utf8; use open qw( :utf8 :std ); sub ᚠርƊ () { 1 } *ᚠርƊ = sub () { 2 }; EXPECT -Constant subroutine main::ᚠርƊ redefined at - line 6. +Constant subroutine main::ᚠርƊ redefined at - line 5. ######## |