I'm not exactly sure what the original poster wants, but I believe he already has a module full of subs. AUTOLOAD only gets called when a particular sub doesn't exist in that namespace, correct?
But I think it's a good idea -- if you can impose a wrapper over the orignal module, you can track all subsequent calls:
package Foo; sub foo1 { ... } sub foo2 { ... } # etc 1; package Wrapper; use Foo; use vars qw/ $AUTOLOAD /; sub AUTOLOAD { my $subname = $AUTOLOAD; $subname =~ s/.*:://; if( UNIVERSAL::can( 'Foo', $subname ) ) { print LOG "Foo::$subname called\n"; return eval "Foo::$subname( \@_ )"; } else { croak "No such sub: $AUTOLOAD"; } }
This way you can keep track of exactly every subroutine call in Foo. Is that what you are saying?
In reply to Re: Re: Convenient way to track function calls?
by lestrrat
in thread Convenient way to track function calls?
by mr.dunstan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |