This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #70836] Fix err msg for unterminated here-doc in eval
authorFather Chrysostomos <sprout@cpan.org>
Sun, 19 Aug 2012 06:54:02 +0000 (23:54 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 21 Aug 2012 21:10:59 +0000 (14:10 -0700)
commit5af08aedbe30651caf3374bc93f1aa7385b9531f
treea6aceb62673fb944db0a99220fff8a5d2baec26f
parente07d7e14bdcbce2e3fdcfb70ac0e637a7e39e2dd
[perl #70836] Fix err msg for unterminated here-doc in eval

$ perl -e '<<foo'
Can't find string terminator "foo" anywhere before EOF at -e line 1.

$ perl -e 'eval "<<foo"; die $@'
Can't find string terminator "
foo" anywhere before EOF at (eval 1) line 1.

An internal implementation detail is leaking out.

When the lexer happens to have a multiline string in its line buffer
(in a string eval or quoted construct), it looks for "\nfoo" instead
of "foo".  It was passing that same string to the error-reporting code
(S_missingterm), resulting in that extraneous newline.
t/lib/croak/toke
toke.c