geckosan has asked for the wisdom of the Perl Monks concerning the following question:

Struggling with this one.. How on earth can I combine CGI::Carp qw(fatalstobrowser cluck set_message etc.) and like maybe $SIG{ __DIE__ } and such to have fatal errors caught and printed to the browser window WITH a complete stack trace?

Replies are listed 'Best First'.
Re: Error Output
by kennethk (Abbot) on Jan 21, 2009 at 20:56 UTC
    You can generate a fatal error with full stack trace with confess, and then have that message sent to browser using CGI::Carp qw(fatalstobrowser). It's all in CGI::Carp.
      ah you pointed me in the right direction. $SIG{ __DIE__ } = sub { confess( @_ ) }; with fatalstobrowser did the trick, thanks mighty monks. for some reason that particular combination was eluding me. o_o
      I'm not generating the error, it's coming up in the code.
        If your code is calling die, then $SIG{__DIE__}=\&{cluck @_}; along with CGI::Carp qw(fatalstobrowser) should do you.
Re: Error Output
by leocharre (Priest) on Jan 21, 2009 at 20:55 UTC