[Catalyst] Stack tracing exceptions

Dan Sully daniel at electricrain.com
Sat Dec 10 06:54:29 CET 2005


* Matt S Trout shaped the electrons to say...

>On Fri, Dec 09, 2005 at 08:02:00AM -0600, Brandon Black wrote:
>> The bigger issue, IMHO, is that exceptions provide no stack trace.
>
>Try applying the following patch to trunk and see how you go. It manages
>the stack trace part, but the trace is maybe a little verbose as yet (hence
>why it's a patch rather than a commit). An example stack trace follows the
>patch.

Or try this instead of Carp::longmess, which I find much more readable:

my $frame = 1;
my $msg   = 'Backtrace: ';

while (my ($filename, $line, $subroutine) = (caller($frame++))[1,2,3]) {

	$msg .= sprintf("   frame %d: $subroutine ($filename line $line)\n", $frame - 2);
}

-D
--
vacation (n) : an extended trip away from home in search of inconvenient ways to connect to the Internet.



More information about the Catalyst mailing list