in reply to Object-oriented interface for binmode

I think this is just an oversight and that you can patch in your own binmode method:
use IO::Handle; sub IO::Handle::binmode { @_ == 2 or Carp::croak 'usage: $io->binmode(DISCIPLINE)'; binmode($_[0], $_[1]); } STDIN->binmode(":raw");

Does anyone know of a drawback or problem with this approach? And should it be submitted as an improvement to the core IO::Handle module?

Replies are listed 'Best First'.
Re^2: Object-oriented interface for binmode
by gellyfish (Monsignor) on Jul 09, 2004 at 09:03 UTC

    The only problem I can see with this is that something derived fron IO::Handle may not be able to cope with being binmoded (or vice versa) - the tests would need to include all of the child IO::* classes to ensure they don't get broken.

    /J\

Re^2: Object-oriented interface for binmode
by BrowserUk (Patriarch) on Jul 09, 2004 at 09:13 UTC

    It should probably also be usable in the original way:

    STDIN->binmode;

    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