Next | Tricks of the Wizards | 39 |
Suppose we'd like to trace execution of the functions in a package
To do that, we'll replace each function with a 'wrapper'
The wrapper will announce that the function is being called
Then call the real function
Basic idea:
my $real_func = \&*$func_name; *$func_name = sub { print "$func_name(@_)\n"; $real_func->(@_); };
Next | Copyright © 2003 M. J. Dominus |