in reply to How to instrument a "fake" subroutine?
In any case, temporarily putting the old glob back in place fixes it, and AUTOLOAD is only called the first time, as things should be.
/s#!/usr/bin/perl -w use Fcntl qw(LOCK_EX); # instrument LOCK_EX my $lock_ex_coderef = \&Fcntl::LOCK_EX; my $newglob = *Fcntl::LOCK_EX = sub { print "LOCK_EX called\n"; no warnings 'redefine'; *Fcntl::LOCK_EX = $lock_ex_coderef; if (wantarray) { my @ret = &$lock_ex_coderef; *Fcntl::LOCK_EX = $newglob; @ret; } else { my $ret = &$lock_ex_coderef; *Fcntl::LOCK_EX = $newglob; $ret; } }; # call LOCK_EX print $_ = LOCK_EX; print "\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: How to instrument a "fake" subroutine?
by samtregar (Abbot) on May 22, 2002 at 21:09 UTC |