Alan said:
Has it never occurred to you to ask yourself why CGI.pm, for example,
contains this comment:
# Define the CRLF sequence. I can't use a simple "\r\n" because the meaning
# of "\n" is different on different OS's (sometimes it generates CRLF, sometimes LF
# and sometimes CR).
CGI.pm would appear to be wrong. "\n" demonstrably does not produce
CRLF, either on ActivePerl for Windows or on MSYS perl.
perl -e "print length(qq(\n))"
prints "1".
Wouldn't you be prepared to admit that you were mistaken, and to
refer readers to perlport for more reliable information on this
matter?
perlport is distinctly confused on the subject; it badly needs to be
rewritten both for clarity and for factual correctness. e.g., in "when
accessing a file in 'text' mode, STDIO translates it to (or from)
\015\012, depending on whether you're reading or writing.", either the
"reading" and "writing" or the "to" and "from" need to be interchanged;
and "You can get away with this on Unix and Mac OS (they have a single
character end-of-line), but the same program will break under DOSish
perls because you're only chop()ing half the end-of-line." is flat
contrary to the way Perl has worked on DOSish systems for as long as I
can remember (and that's over a decade), unless it is describing the
anomalous case of a text file that has been read in binary mode.
And, by the way, on MacOS 10.4, ord("\n") returns "10", just as it does
on Unix and Windows; I just checked now. I don't know what perl ports on
MacOS Classic did.