in reply to Convenient way to track function calls?

Heh. This is kinda outrageous, but...

I presume there are no prototypes (useless in modules). If the declaration style is consistent, create a debugging version of the module with: perl -pe 's/sub\s+(\w+)\s+{/sub $1 { print STDERR "entering $1\n"; /'All on one line, of course.

/me ducks to dodge the rotten tomatoes....

Replies are listed 'Best First'.
Re: Re: Convenient way to track function calls?
by blakem (Monsignor) on Aug 29, 2001 at 23:29 UTC
    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