develooper Front page | perl.perl5.porters | Postings from March 2019

[perl #133949] paragraph input mode ($/="") prevents readline fromreturning latest paragraph from pipe

From:
Tony Cook via RT
Date:
March 31, 2019 23:35
Subject:
[perl #133949] paragraph input mode ($/="") prevents readline fromreturning latest paragraph from pipe
Message ID:
rt-4.0.24-5145-1554075294-1013.133949-15-0@perl.org
On Wed, 27 Mar 2019 21:42:21 -0700, rob.navarro@appdynamics.com wrote:
> Thank you for the clear response.
> I understand your point about readline() needing to consume all
> inter-paragraph newlines, but this should not mean that after a valid
> delimited paragraph is found that that paragraph should not be returned
> immediately.
> Surely it makes better sense to return the correctly delimited paragraph as
> soon as it is recognised and *then* keep consuming new lines. After all,
> the final paragraph has been correctly delimited and we should now just be
> awaiting the next one - if any.

The problem with not consuming the extra newlines is the next read from the stream might not be from readline, existing code might expect paragraph mode to consume them and then switch $/ = "\n" to consume a line at a time, or use read().

It would be a backwardly incompatible change.

Tony

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



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