The following code will no longer warn:
use warnings 'redefine';
sub foo {}
local *foo = sub{};
The main purpose of local() is to temporarily redefine stuff, so it
doesn't make sense to warn about it.
=item *
-XXX Describe change here
+L<Subroutine %s redefined|perldiag/"Subroutine %s redefined">
+
+Localized subroutine redefinitions no longer trigger this warning.
=back
(CvROOT(cv) || CvXSUB(cv)) &&
/* redundant check that avoids creating the extra SV
most of the time: */
- (CvCONST(cv) || ckWARN(WARN_REDEFINE)))
+ (CvCONST(cv) || (ckWARN(WARN_REDEFINE) && !intro)))
{
SV * const new_const_sv =
CvCONST((const CV *)sref)
*Foo::f =sub {};
EXPECT
Subroutine f redefined at - line 5.
+########
+# sv.c
+use warnings 'redefine';
+sub fred { 1 }
+sub barney() { 2 }
+sub wilma() { 3 }
+# local redefines of subs shouldn't warn...
+local *fred = sub {};
+local(*fred) = sub {};
+# ...unless they're constant
+local *barney = \&fred;
+local(*wilma) = \&fred;
+EXPECT
+Constant subroutine main::barney redefined at - line 10.
+Constant subroutine main::wilma redefined at - line 11.