summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-09-24 16:24:54 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-24 16:25:13 -0700
commit898c3bcab476295054cadaceb5ce68aa230a2d46 (patch)
treed73a00f43bdf698d9458ecd2b2c2e3805b95a1f9 /toke.c
parent87385d72ee968c05cac84105545a64b37202374d (diff)
downloadperl-898c3bcab476295054cadaceb5ce68aa230a2d46.tar.gz
[perl #77240] Don’t warn for --subname
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index e0e0acd273..d22551460e 100644
--- a/toke.c
+++ b/toke.c
@@ -6786,6 +6786,10 @@ Perl_yylex(pTHX)
just_a_word: {
int pkgname = 0;
const char lastchar = (PL_bufptr == PL_oldoldbufptr ? 0 : PL_bufptr[-1]);
+ const char penultchar =
+ lastchar && PL_bufptr - 2 >= PL_linestart
+ ? PL_bufptr[-2]
+ : 0;
#ifdef PERL_MAD
SV *nextPL_nextwhite = 0;
#endif
@@ -7014,7 +7018,7 @@ Perl_yylex(pTHX)
/* Not a method, so call it a subroutine (if defined) */
if (cv) {
- if (lastchar == '-') {
+ if (lastchar == '-' && penultchar != '-') {
const SV *tmpsv = newSVpvn_flags( PL_tokenbuf, len ? len : strlen(PL_tokenbuf), (UTF ? SVf_UTF8 : 0) | SVs_TEMP );
Perl_ck_warner_d(aTHX_ packWARN(WARN_AMBIGUOUS),
"Ambiguous use of -%"SVf" resolved as -&%"SVf"()",