Krang::ErrorHandler - consistent die() and warn() handlers for Krang


At the top of your script or module:

  use Krang::ClassLoader 'ErrorHandler';


When you use this module, $SIG{__DIE__} and $SIG{__WARN__} handlers are setup such that all die() and warn() messages are sent to Krang::Log. This does not alter their operation - die() still really die()s and warn() still prints to STDERR.

This module also turns on the Trace option for all Exception::Class usage in Krang. This causes a stack trace to be printed when an unhandled exception is printed.

Note that Krang::Script uses Krang::ErrorHandler, so test scripts don't need to use this module explicitely. However, CGI scripts do because when run under mod_cgi they will run in their own process.