Autrijus Tang has just uploaded Devel::Hints on CPAN. I was about to code this module myself, but Autrijus did a better job (and obviously he did it faster.) I was going to use Inline::C instead of XS, and I didn't thought about adding an optional call stack level parameter to the cop_* functions. (More on that topic in the next P5P summary.)
Re:A neat hammer...
autrijus on 2003-01-30T19:52:10
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;
}