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

Re: [perl #128557] Trailing space in heredoc delimiter

Thread Previous | Thread Next
From:
Sawyer X
Date:
October 1, 2017 11:52
Subject:
Re: [perl #128557] Trailing space in heredoc delimiter
Message ID:
53c85d56-c9af-588b-0199-2fa897a4e4c6@gmail.com


On 09/30/2017 07:27 PM, James E Keenan via RT wrote:
> 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.

Agreed.

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