diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-06 20:31:44 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-06 20:31:44 +0000 |
commit | 5315574d134a1fb58aaf7b1730a6eef7afd7ba4c (patch) | |
tree | a2de945f14de93d1e4cef1a6460b036a99ff91c9 /pod | |
parent | e788e7d35b1f8979a002a1e994535be7aae30018 (diff) | |
download | perl-5315574d134a1fb58aaf7b1730a6eef7afd7ba4c.tar.gz |
more reasonable diagnostic on keyword vs. sub ambiguity
p4raw-id: //depot/perl@1340
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perldiag.pod | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod index c2c5be1371..0805db3ebd 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -207,6 +207,22 @@ L<perlfunc/grep> and L<perlfunc/map> for alternatives. you thought. Normally it's pretty easy to disambiguate it by supplying a missing quote, operator, parenthesis pair or declaration. +=item Ambiguous call resolved as CORE::%s(), qualify as such or use & + +(W) A subroutine you have declared has the same name as a Perl keyword, +and you have used the name without qualification for calling one or the +other. Perl decided to call the builtin because the subroutine is +not imported. + +To force interpretation as 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). + +To silently interpret it as the Perl operator, use the C<CORE::> prefix +on the operator (e.g. C<CORE::log($x)>) or by declaring the subroutine +to be an object method (see L<attrs>). + =item Args must match #! line (F) The setuid emulator requires that the arguments Perl was invoked @@ -2379,21 +2395,6 @@ may break this. 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 |