[Tech] simple Perl stacktrace

How to easily get a Perl stack trace? Like this:
print "Stack Trace:\n";
while ( (my @call_details = (caller($i++))) ){
print $call_details[1].":".$call_details[2]." in function ".$call_details[3]."\n";
}
EOF
Back home
14:31:11 27.05.2011 | Permalink | Trackback URI
schirsch (2011-05-28 13:15:43)
Or use the routines (longmes() or so) from the Carp modules that produce way more readable and useful stack traces..
blindcoder (2011-05-29 10:27:58)
Yeah, I've seen the Carp modules, too, while searching for a stack tracer for Perl.
Problem is: I needed this trace on a machine with no internet connectivity (yes, these things still exist today) on a Solaris X machine.
I didn't know of an easy way to get the Carp module and all dependencies loaded in an easy way, and caller() gave me enough information for the problem I had.


