This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
s/${foo#}//e should be an error
authorFather Chrysostomos <sprout@cpan.org>
Fri, 31 Aug 2012 16:29:21 +0000 (09:29 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 31 Aug 2012 19:31:27 +0000 (12:31 -0700)
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
toke.c

index c974797..93985e7 100644 (file)
@@ -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 (file)
--- 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);
            }