From 90a536e1429209983a0eb4bcdfe728d82726b3e9 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Fri, 31 Aug 2012 09:29:21 -0700 Subject: [PATCH] s/${foo#}//e should be an error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit See also the previous commit. This one was caused by 9c74ccc. Again, we can’t just check whether PL_lex_repl has the SvEVALED flag set (which means we are in s///e), but must also check whether PL_lex_repl == PL_linestr (which means we are in the replacement part of s///e). --- t/base/lex.t | 6 +++++- toke.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/t/base/lex.t b/t/base/lex.t index c974797..93985e7 100644 --- a/t/base/lex.t +++ b/t/base/lex.t @@ -1,6 +1,6 @@ #!./perl -print "1..73\n"; +print "1..74\n"; $x = 'x'; @@ -363,3 +363,7 @@ $_ = "not ok 73"; $x{3} = "not "; eval 's/${\%x}{3}//e'; print "$_ - s//\${\\%x}{3}/e\n"; + +eval 's/${foo#}//e'; +print "not " unless $@; +print "ok 74 - s/\${foo#}//e\n"; diff --git a/toke.c b/toke.c index 9b765e6..ec633c4 100644 --- a/toke.c +++ b/toke.c @@ -5279,7 +5279,7 @@ Perl_yylex(pTHX) s = d; if (in_comment && d == PL_bufend && PL_lex_state == LEX_INTERPNORMAL - && PL_lex_inwhat == OP_SUBST && PL_lex_repl + && PL_lex_inwhat == OP_SUBST && PL_lex_repl == PL_linestr && SvEVALED(PL_lex_repl) && d[-1] == '}') s--; else incline(s); } -- 2.7.4