From: Ben Carter Date: Fri, 9 Jun 2006 02:08:44 +0000 (-0700) Subject: [perl #39365] Bug in toke.c (eval in subst) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2d997502fd695609fa2064523de2ba2d8d094b6c;p=p5sagit%2Fp5-mst-13.2.git [perl #39365] Bug in toke.c (eval in subst) From: bcarter@gumdrop.flyinganvil.org (via RT) Message-ID: plus a regression test. p4raw-id: //depot/perl@28404 --- diff --git a/t/comp/parser.t b/t/comp/parser.t index 439dc71..e1eff35 100644 --- a/t/comp/parser.t +++ b/t/comp/parser.t @@ -9,7 +9,7 @@ BEGIN { } require "./test.pl"; -plan( tests => 59 ); +plan( tests => 60 ); eval '%@x=0;'; like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' ); @@ -207,3 +207,6 @@ like( $@, qr/Bad name after foo'/, 'Bad name after foo\'' ); # test for ?: context error eval q{($a ? $x : ($y)) = 5}; like( $@, qr/Assignment to both a list and a scalar/, 'Assignment to both a list and a scalar' ); + +eval q{ s/x/#/e }; +is( $@, '', 'comments in s///e' ); diff --git a/toke.c b/toke.c index 988b269..4eef362 100644 --- a/toke.c +++ b/toke.c @@ -10720,7 +10720,7 @@ S_scan_subst(pTHX_ char *start) sv_catpv(repl, es ? "eval " : "do "); sv_catpvs(repl, "{"); sv_catsv(repl, PL_lex_repl); - sv_catpvs(repl, "}"); + sv_catpvs(repl, "\n}"); SvEVALED_on(repl); SvREFCNT_dec(PL_lex_repl); PL_lex_repl = repl;