This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
here-doc in quotes in multiline s//.../e in eval
authorFather Chrysostomos <sprout@cpan.org>
Mon, 20 Aug 2012 21:55:09 +0000 (14:55 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 21 Aug 2012 21:11:02 +0000 (14:11 -0700)
commit043cc6c601c03ac1644cea26a20b39eb34957445
treed460ea31424c8d44bd08002fba09ba7f37a334df
parent565b52dfca4375468541e36d53e8a2aba372c056
here-doc in quotes in multiline s//.../e in eval

When <<END occurs on the last line of a quote-like operator inside a
string eval ("${\<<END}"), it peeks into the linestr buffer of the
parent lexing scope (quote-like operators start a new lexing scope
with the linestr buffer containing what is between the quotes) to find
the body of the here-doc.  It modifies that buffer, stealing however
much it needs.

It was not leaving things in the consistent state that s///e checks
for when it finishes parsing the replacement (to make sure s//}+{/
doesn’t ‘work’).  Specifically, it was not shrinking the parent buf-
fer, so when PL_bufend was reset in sublex_done to the end of the par-
ent buffer, it was pointing to the wrong spot.
perl.h
t/base/lex.t
toke.c