[Catalyst] p-static-simple line-ending patch

Carl Franks fireartist at gmail.com
Fri Feb 24 14:08:19 CET 2006


On 23/02/06, Andy Grundman <andy at hybridized.org> wrote:

> What will this do on text files with DOS line-endings?

It means on dos/win/os-2 systems, when the files are read, "\r\n" will
be translated internally to "\n", and then when it's written to
stdout, each "\n" will be written as "\r\n".

On my windows system, if I do ...
perl -e "print qq{{\r\n}" > test.txt
... the file is 3 bytes.

If I do ...
perl -e "print qq{\n}" > test.txt
... the file is 2 bytes.

If the dos text files are read in binmode, each "\r\n" won't be
translated internally to "\n", it will be left as "\r\n".
My test above suggests that when the DOS file is written back to
stdout, each "\r\n" is incorrectly translated to "\r\r\n".

According to perldoc, binmode only effects non-text files on
win/dos/similar systems.

It also states "never use it when it isn't appropriate"; meaning with
text files.

All this suggests the patch is appropriate, however see my reply to
Aristotle in this thread for other related issues (!)

Carl



More information about the Catalyst mailing list