in reply to Re: Convenient way to track function calls?
in thread Convenient way to track function calls?

Just to make a bad idea, slightly better....
At least make a sub for printing to stderr. How about adding:
sub debuglogger { my $msg = shift; if ($DEBUG) { print STDERR "$msg\n"; } }
Then changing your globlal replace command to:
's/sub\s+(\w+)\s+{/sub $1 { debuglogger("entering $1"); /'
That way you can toggle the output with the $DEBUG var, and do fancy things like adding timestamps or changing where to debugging information goes w/o resorting to another -pi -e command.

-Blake