This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Commit 6b00f562ed broke s/${\%x}{3}//e
authorFather Chrysostomos <sprout@cpan.org>
Fri, 31 Aug 2012 16:27:25 +0000 (09:27 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 31 Aug 2012 19:31:26 +0000 (12:31 -0700)
It was meant to check whether it was inside the replacement part of
s///e, but it only checked that it was inside s///e.  PL_lex_repl is
set on both sides, but is only equal to PL_linestr on the rhs.

t/base/lex.t
toke.c

index 1201436..c974797 100644 (file)
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..72\n";
+print "1..73\n";
 
 $x = 'x';
 
@@ -358,3 +358,8 @@ print "ok 71 - s//'#' . <<END/e\n";
 eval "s//3}->{3/e";
 print "not " unless $@;
 print "ok 72 - s//3}->{3/e\n";
+
+$_ = "not ok 73";
+$x{3} = "not ";
+eval 's/${\%x}{3}//e';
+print "$_ - s//\${\\%x}{3}/e\n";
diff --git a/toke.c b/toke.c
index 933503b..9b765e6 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -5932,7 +5932,7 @@ Perl_yylex(pTHX)
 #endif
                    return yylex();     /* ignore fake brackets */
                }
-               if (PL_lex_inwhat == OP_SUBST && PL_lex_repl
+               if (PL_lex_inwhat == OP_SUBST && PL_lex_repl == PL_linestr
                 && SvEVALED(PL_lex_repl))
                    PL_lex_state = LEX_INTERPEND;
                else if (*s == '-' && s[1] == '>')