in reply to Re: strange newline behavior in Win32 with CGI.pm and STDOUT
in thread strange newline behavior in Win32 with CGI.pm and STDOUT

Ah. That would do it. As it happens I'm using CGI::Simple but I noticed that CGI.pm has the same effect, which is why I wrote the OP that way. So now I just need to dig in and figure out what to do about it. My issue is that I'm only using the form-parsing aspects, not the HTML-generation aspects, and the data I'm writing to STDOUT has nothing to do with the CGI per se (it's actually more like log data), so I need to find a way around that behavior.

If you're curious about what my actual program is doing it is something like this.

  • Comment on Re^2: strange newline behavior in Win32 with CGI.pm and STDOUT

Replies are listed 'Best First'.
Re^3: strange newline behavior in Win32 with CGI.pm and STDOUT
by crashtest (Curate) on Dec 06, 2005 at 23:53 UTC

    Not sure if you've already worked around the problem but one apparent way is to just revert the settings with some binmode calls of your own (after CGI has been loaded):

    use CGI; binmode $_, ':crlf' for (\*STDOUT, \*STDERR, \*STDIN); print "foo\nbar\n";

    That produced the right "0D0A" line endings for me.