PApp::Exception - exception handling for PApp
use PApp::Exception; # to be written
# to be written
$SIG{__DIE__}
(e.g.
inside an eval). The advantage in using this function is that you get a
useful backtrace on an error (among some other information). It should be
compatible with any use of eval but might slow down evals that make heavy
use of exceptions (but these are slow anyway).
Example:
eval { local $SIG{__DIE__} = \&PApp::Exception::diehandler; ... };
as_string
.
title exception page title (default "PApp:Exception") body the exception page body category the error category error the error message or error object info additional info (arrayref) backtrace optional backtrace info compatible if set, stringification will only return this field
When called on an existing object, a clone of that exception object is created and the information is extended (backtrace is being ignored, title, info and error are extended).
$error
should be a short error message, while
$additional_info
can be a multi-line description of the problem.
The rest of the function call consists of named arguments that are transparently passed to the PApp::Exception::new constructor (see above), with the exception of:
skipcallers the number of caller levels to skip in the backtrace
fancydie
, but warns only. (not exported by default).
eval
the given block (using a _diehandler
, @_
will contain
useless values and the context will always be array context). If no error
occurs, return, otherwise execute fancydie with the error message and the
rest of the arguments (unless they are catch
'ed).
try
, execute the block when
an error occurs.
ep_wrap(...)
Marc Lehmann <pcg@goof.com> http://www.goof.com/pcg/marc/