(S) An internal warning that the grammar is screwed up.
-=item Operation `%s': no method found,%s
+=item Operation `%s': no method found, %s
(F) An attempt was made to perform an overloaded operation for which
no handler was defined. While some handlers can be autogenerated in
eval "sub name { ... }";
}
+=item Subroutine %s hidden by keyword; use ampersand
+
+(W) You are trying to call a subroutine that has the same name as a
+keyword. However, because the subroutine is not imported and
+you're not using an ampersand, Perl won't call the subroutine.
+
+To force a subroutine call, either put an ampersand before the
+subroutine name, or qualify the name with its package. Alternatively,
+you can import the subroutine (or pretend that it's imported with the
+C<use subs> pragma).
+
+If the Perl operator is what you want, then eliminate this warning by
+using the CORE:: prefix on the operator (e.g. CORE::log($x)) or by
+declaring the subroutine to be an object method (see L<attrs>).
+
=item Substitution loop
(P) The substitution was looping infinitely. (Obviously, a
}
if (tmp < 0) { /* second-class keyword? */
- if (expect != XOPERATOR && (*s != ':' || s[1] != ':') &&
- (((gv = gv_fetchpv(tokenbuf, FALSE, SVt_PVCV)) &&
- GvCVu(gv) && GvIMPORTED_CV(gv)) ||
- ((gvp = (GV**)hv_fetch(globalstash,tokenbuf,len,FALSE)) &&
- (gv = *gvp) != (GV*)&sv_undef &&
- GvCVu(gv) && GvIMPORTED_CV(gv))))
- {
- tmp = 0; /* overridden by importation */
+ GV *ogv = Nullgv; /* override (winner) */
+ GV *hgv = Nullgv; /* hidden (loser) */
+ if (expect != XOPERATOR && (*s != ':' || s[1] != ':')) {
+ CV *cv;
+ if ((gv = gv_fetchpv(tokenbuf, FALSE, SVt_PVCV)) &&
+ (cv = GvCVu(gv)))
+ {
+ if (GvIMPORTED_CV(gv))
+ ogv = gv;
+ else if (! CvMETHOD(cv))
+ hgv = gv;
+ }
+ if (!ogv &&
+ (gvp = (GV**)hv_fetch(globalstash,tokenbuf,len,FALSE)) &&
+ (gv = *gvp) != (GV*)&sv_undef &&
+ GvCVu(gv) && GvIMPORTED_CV(gv))
+ {
+ ogv = gv;
+ }
+ }
+ if (ogv) {
+ tmp = 0; /* overridden by import or by GLOBAL */
}
else if (gv && !gvp
&& -tmp==KEY_lock /* XXX generalizable kludge */
{
tmp = 0; /* any sub overrides "weak" keyword */
}
- else {
- tmp = -tmp; gv = Nullgv; gvp = 0;
+ else { /* no override */
+ tmp = -tmp;
+ gv = Nullgv;
+ gvp = 0;
+ if (dowarn && hgv)
+ warn("Subroutine %s::%s hidden by keyword; use ampersand",
+ HvNAME(GvESTASH(hgv)), GvENAME(hgv));
}
}