in reply to Win32 CGI breaks STDIN?

I expect the reason that the open(INDIR, $indir) part breaks is that, binmode() having been called on STDIN, $indir ends with a carriage return.

my $indir = <STDIN>; # $indir = "directory\r\n"; # binmode stops the \r\n -> \n translation chomp $indir; # chomp removes $/, which is "\n" # the \r is left intact
A quick fix in your script is to make sure the \r is removed as well.

The ideal fix is for CGI not to call binmode() on STDIN when the script is run interactively.

Replies are listed 'Best First'.
Re: Re: Win32 CGI breaks STDIN?
by Anonymous Monk on Feb 01, 2001 at 00:35 UTC

    Perhaps even...

    if ($needs_binmode) { $CGI::DefaultClass->binmode(main::STDOUT) unless ( -t main::STDOUT ); $CGI::DefaultClass->binmode(main::STDIN) unless ( -t main::STDIN ); $CGI::DefaultClass->binmode(main::STDERR) unless ( -t main::STDERR ); }

    ?