Open haukex opened 4 years ago
It looks intentional, originally added in f63a84b229f1dfb5c1bb698e1ed4bb362b3e6a6b.
A commit adding code gated with TMP_CRLF_PATCH with no explanation always inspires confidence...
If I had to guess, it's so that \r\n that commonly shows up in dos type files does not affect the contents of the heredocs.
Some ancient p5p threads about this topic: "[(pseudo) BUG] in here documents" - https://markmail.org/message/ihvj5jaumpiuxikc "CRs et al" - https://markmail.org/message/5goj3bcwhboqkcdg "[PATCH _71] CRs et al" - https://markmail.org/message/a52h64tm7a4laccp
From those links it appears to be deliberate.
Thanks for the replies everyone! I will look at the docs and I think I'll suggest a patch.
Output:
I would have expected both outputs to be the same, that is,
"X\r\nY \r\n A \r B\n"
. I've looked in the docs (perlop in particular), the Camel, and the issue tracker, but haven't found anything that documents this behavior.Although it's possible I may have missed it in the docs, there are statements in the documentation that I find misleading, such as in the description of
<<EOF
in perlop: "Double quotes [on the terminator] indicate that the text will be interpolated using exactly the same rules as normal double quoted strings."I think that the docs should be clarified to describe this behavior in a prominent place, and if someone could confirm that this behavior is intentional and not a bug, I could provide a doc patch. Otherwise, if this behavior isn't intentional, that would make this a real bug.
This behavior seems to be the same across all Perl releases since 5.6.2 (and probably before, I just don't have one installed to test on).