in reply to Colorized HTML stack trace
use CGI::Carp qw( fatalsToBrowser set_message ); use Devel::StackTrace; use HTML::Template; use Data::Dumper; BEGIN { my $VERBOSE = 0; set_message(sub { my $msg = shift; my $trace = Devel::StackTrace->new; my $tmpl = HTML::Template->new(filehandle => \*DATA); my %param = (msg => $msg); while(my $frame = $trace->next_frame) { my %frame = (subroutine => $frame->subroutine); chomp($VERBOSE # Nov. 10, 2003 did i make a typo? #chomp($frame{args} = $VERBOSE ? $frame{args} = Dumper($frame->args) : join(',', $frame->args) ); $frame{file} = $frame->filename; $frame{line} = $frame->line; push @{$param{stack}}, \%frame; } $tmpl->param(%param); print $tmpl->output; }); } __DATA__ <html> <head> <title>debug the error!!!</title> <style type="text/css"> span.subroutine { color: blue; } span.args { color: red; } span.file { color: blue; } span.line { color: green; } </style> </head> <body> <h1>debug the error!!!</h1> <pre><tmpl_var msg></pre> <hr/> <h3>Stacktrace</h3> <pre> <tmpl_loop stack> <span class="subroutine"><tmpl_var subroutine></span>('<span class="ar +gs"><tmpl_var args></span>') called at <span class="file"><tmpl_var file></span> line <span clas +s="line"><tmpl_var line></span> </tmpl_loop> </pre> </body> </html>
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|