{
if (is_our && (SvPAD_OUR(sv)))
break; /* "our" masking "our" */
+ /* diag_listed_as: "%s" variable %s masks earlier declaration in same %s */
Perl_warner(aTHX_ packWARN(WARN_MISC),
- "\"%s\" variable %"SVf" masks earlier declaration in same %s",
+ "\"%s\" %s %"SVf" masks earlier declaration in same %s",
(is_our ? "our" : PL_parser->in_my == KEY_my ? "my" : "state"),
+ *SvPVX(sv) == '&' ? "subroutine" : "variable",
sv,
(COP_SEQ_RANGE_HIGH(sv) == PERL_PADSEQ_INTRO
? "scope" : "statement"));
stubs. Stubs should never be implicitly created, but explicit calls to
C<can> may break this.
+=item "%s" subroutine &%s masks earlier declaration in same %s
+
+(W misc) A "my" or "state" subroutine has been redeclared in the
+current scope or statement, effectively eliminating all access to
+the previous instance. This is almost always a typographical error.
+Note that the earlier subroutine will still exist until the end of
+the scope or until all closure referents to it are destroyed.
+
=item Subroutine %s redefined
(W redefine) You redefined a subroutine. To suppress this warning, say
state sub foo;
state sub foo {};
';
-on;
is $w,
- '"state" subroutine foo masks earlier declaration in same scope at '
+ '"state" subroutine &foo masks earlier declaration in same scope at '
. "squidges line 88.\n",
- 'redefinition warning for state sub';
-off;
+ 'warning for state sub masking earlier declaration';
}
# Since state vars inside anonymous subs are cloned at the same time as the
# anonymous subs containing them, the same should happen for state subs.