You might want to look at the CPAN module Devel::Trace.
It prints out program lines as they're executed. See http://www.plover.com/~mjd/perl/Trace
for details. Might be easier than using the standard debugger.
More interestingly, there's the Devel::TraceFuncs module, which does this:
Devel::TraceFuncs lets you instrument your programs, so you can see
what subroutines get called when, and by whom. This is particularly
useful if you have a timing problem that doesn't show up if you use
the debugger (a "heisenbug").
The following program:
use Devel::TraceFuncs qw(trace debug);
sub foo {
trace(my $f);
debug "hi";
}
trace(my $f);
foo(1, 2);
debug "there";
produces this output:
+-> global
| +-> main::foo(1, 2) (in t.pm:10)
| | hi (in t.pm:6)
| +-< main::foo(1, 2) (in t.pm:10)
| there (in t.pm:11)
+-< global
I haven't tried these, so your mileage may vary.
Also, read Refactoring by Martin Fowler. Great advice in there
about how to cope with legacy pasta.
stephen
|