http://www.politiker-stopp.de/gfx/politiker-stopp-print.png
Stoppt die Vorratsdatenspeicherung! Jetzt klicken &handeln! Willst du auch an der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:

[] simple Perl stacktrace RSS feed for section Tech

How to easily get a Perl stack trace? Like this:

my $i = 1;
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  clock 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.

Leave a comment

Allowed HTML tags: a abbr acronym b blockquote em li ol p strong sub sup u ul

Name


Link (enter mailto:you@address.com for mailaddress, otherwise http:// is implied)


Comment