Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • A neat hammer, but I don't see what the nails for it are. I'd love to see some examples that show how this can help the average programmer. Or is it a module that only an internals-lovin' programmer could love?
    --

    --
    xoa

    • by autrijus (1505) on 2003.01.30 14:52 (#16549) Homepage Journal
      Here's the nail I wrote the hammer for, a CORE::GLOBAL::open() overrider that respects the 'use open' pragma in the caller's block:

      sub open (*;@) {
              # ...
              my $ret = CORE::open($fh, $mode, $file) or return 0;
              # ...
              my $binmode = Devel::Hints::cop_io(1);
              $binmode = (split(/\x00/, $binmode))[($mode =~ />/) ? 1 : 0];
              binmode($fh, $binmode) if $binmode;
              $_[0] ||= $fh;
              $ret;
      }