in reply to Re: Object-oriented interface for binmode
in thread Object-oriented interface for binmode

Given STDIN isn't an object, what would be the benefit of STDIN->binmode(...); over binmode( STDIN, ... )?

As with the rest of IO::Handle, the advantage is in being able to use a standard idiom of lexical references and method calls -- if you're accustomed to using object techniques, it's awkward for one part of your program to suddenly switch to a different idiom of barewords and builtins.

Given that some people find IO::Handle useful, the question about why it's missing the binmode method is perfectly reasonable.

  • Comment on Re^2: Object-oriented interface for binmode

Replies are listed 'Best First'.
Re^3: Object-oriented interface for binmode
by BrowserUk (Patriarch) on Jul 08, 2004 at 23:30 UTC

    Had the question been framed in terms of an IO::Handle or IO::File object, which can be lexical, I probably wouldn't have asked my question.

    I too find it strange that neither of these implement the binmode method. It is a part of the Tie::Handle spec. I'm guessing that prior to the advent of IOlayers, there wasn't much call for binmode on unix systems.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    "Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon