develooper Front page | perl.perl5.porters | Postings from August 2012

[perl #114104] bogus error message for unterminated heredoc terminator

Thread Previous
Father Chrysostomos via RT
August 2, 2012 00:36
[perl #114104] bogus error message for unterminated heredoc terminator
Message ID:
On Thu Jul 12 03:10:38 2012, wrote:
> This is a bug report for perl from,
> generated with the help of perlbug 1.39 running under perl 5.16.0.
> -----------------------------------------------------------------
> [Please describe your issue here]
> #!perl
> $_ = <<"foo
> foo
> foo
> __END__
> Can't find string terminator "foo
> " anywhere before EOF at line 2.
> The error message is bogus because there are in fact two "foo\n"'s in
>    the code.
> The real problem is that there is no second '"' to terminate the
>    heredoc
> terminator. This error message should be improved.

There heredoc-scanning code doesn’t care if the delimiter is missing.

So it ends up using everything up to the end of the buffer as its
terminator ("foo\n").  And then bug #114102 kicks in, preventing it from
seeing "\nfoo\n\n".  The real bug here is that scan_heredoc doesn’t
check that delimcpy actually found the final delimiter.

With string eval, I get to see the implicit ; that gets tacked on to the
end of the buffer:

$_ = <<"foo

or die

This gives me:

Can't find string terminator "


;" anywhere before EOF at (eval 1) line 2.
	...propagated at - line 2.


Father Chrysostomos

via perlbug:  queue: perl5 status: open

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About