Subject: | CGI.pm always calls binmode on STDOUT, STDERR, and STDIN, even if they already have IO layers |
In one of my scripts, before I load CGI.pm, I have an encoding() layer
set on STDOUT. Simply calling "use CGI;" will remove that layer, because
CGI.pm does this:
if ($needs_binmode) {
$CGI::DefaultClass->binmode(\*main::STDOUT);
$CGI::DefaultClass->binmode(\*main::STDIN);
$CGI::DefaultClass->binmode(\*main::STDERR);
}
Thus clearing any already-pushed IO layer.