Git Product home page Git Product logo

Comments (2)

leejo avatar leejo commented on August 26, 2024

[email protected] - 2010-05-16 21:26:09

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.

Thanks for the report. What alternative do you recommend?

Mark

from cgi.pm.

leejo avatar leejo commented on August 26, 2024

MKANAT - 2010-05-16 22:50:38

On Sun May 16 17:26:09 2010, [email protected] wrote:

Thanks for the report. What alternative do you recommend?

I'm actually not quite sure. I don't know how to check if a file handle
is already in binmode. I do know how to check if it has an encoding or
utf8 layer on it, though, which is PerlIO::get_layers(FH).

What's the purpose of setting binmode on STD* on Windows? Is it so that
it doesn't do CR->CRLF conversion? I don't know if any way to
specifically remove the :crlf layer, but if there was one, that might be
a better solution.

A simple solution that would resolve my problem would be to not call
CORE::binmode on any of the file handles if they have any non-default
layers (that is, layers other than :crlf, :unix, and :perlio).

from cgi.pm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.