develooper Front page | perl.perl5.porters | Postings from September 2017

[perl #128557] Trailing space in heredoc delimiter

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
September 30, 2017 17:27
Subject:
[perl #128557] Trailing space in heredoc delimiter
Message ID:
rt-4.0.24-23547-1506792440-19.128557-15-0@perl.org
On Sat, 30 Sep 2017 16:18:58 GMT, abigail@abigail.be wrote:
> On Fri, Sep 29, 2017 at 07:27:58PM -0700, James E Keenan via RT wrote:
> > On Wed, 06 Jul 2016 13:50:48 GMT, eda@waniasset.com wrote:
> > >
> > > This is a bug report for perl from eda@waniasset.com,
> > > generated with the help of perlbug 1.40 running under perl 5.22.2.
> > >
> > >
> > > -----------------------------------------------------------------
> > > [Please describe your issue here]
> > >
> > > The end marker for a here-document must be the exact string,
> > > without
> > > trailing spaces.  If the heredoc begins with <<END but instead of
> > > 'END' you have 'END ', Perl treats that as part of the quoted
> > > string
> > > without warning.
> > >
> >
> > I am unsure as to the specific case you are discussing.
> >
> > In the attachment, the first heredoc is defined with '<<END;'.  The
> > second is defined with '<<END ;'  In both cases there is no
> > whitespace after the terminator 'END'.  Both "work" in the sense that
> > both compile and print -- even though the second definition looks
> > weird.
> >
> > Is that the case you are concerned about?  Or something else?
> >
> 
> 
> I think the perceived problem is with a trailing space after the
> terminator *after* the here doc. As in:
> 
> print << END;
> This is printed
> 
> END
> This as well, because the previous line
> has a trailing space.
> 
> END
> 
> 
> 
> I'm not sure how big a problem this is in practise. In many cases, a
> trailing space will lead to a program which doesn't compile. For the
> remaining cases, where both the program compiles and doesn't behave
> badly, a linter (Perl::Critic?) ought to do the trick.
> 

I agree.  I think the feature request should be rejected.

Thank you very much.
-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=128557

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About