develooper Front page | perl.perl5.porters | Postings from June 2011

Is Perl's newline mangling on Win32 necessary?

Thread Next
Christian Walde
June 28, 2011 11:27
Is Perl's newline mangling on Win32 necessary?
Message ID:
On Win32 Perl automatically adds the :crlf layer to a number of filehandles.

This causes a great many problems for a lot of Perl code, since constructs like $fh->binmode; and $s =~ s/\r//g; have to be added everywhere just in case that piece of perl would ever be executed on Windows. Usually this kind of thing only breaks tests, since they compare multiline text quite often; but every once in a while this breaks something important, like the CGI handler in Plack.

I've spent many a month now chasing these things and prodding CPAN authors into fixing them with great success, increasing the amount of CPAN distributions that install and work safely on Win32.

But i am dissatified and quite frankly sick of it. The reason is that as far as i can tell the perl modules are not wrong, not broken. Neither is Win32. In my perception i am chasing tails here to fix a bug in perl core by having everyone BUT perl core implement workarounds for the bug.

I have been working with Perl and Win32 for a long time. However i have never seen a single instance where this :crlf auto-adding was useful. The only and single binary code i know about that actually cares about this thing is notepad.exe.

I am entirely confident that if i were to smoke the entirety of CPAN with the latest perl; and then resmoke it with a fork of that perl, with :crlf auto-adding removed, the overall PASS count would increase a lot and many dists would automagically start testing/working right. Only a very miniscule amount of dists would fail, specifically those that are win32-only and do multiline text comparisons with win32-generated data, which is easily fixed and much smaller in scope than the current situation.

However i might be overlooking something.

As such i have to ask: Are there even any reasons in this day and age to retain this malicious functionality?

With regards,
Christian Walde

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About