I just had to see what would happen if i seperated the content from its presentation. I know it's overkill, but what the heck.
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)

In reply to Re: Colorized HTML stack trace (via HTML::Template) by jeffa
in thread Colorized HTML stack trace by hardburn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.