
Log::Report::Exception - a collected report


# created within a try block
try { error "help!" };
my $exception = $@->wasFatal;
$exception->throw if $exception;
$@->reportFatal; # combination of above two lines
my $message = $exception->message; # the Log::Report::Message
if($message->inClass('die')) ...
if($exception->inClass('die')) ... # same
if($@->wasFatal(class => 'die')) ... # same

In Log::Report, exceptions are not as extended as available in languages as Java: you do not create classes for them. The only thing an exception object does, is capture some information about an (untranslated) report.

Log::Report::Exception->new(OPTIONS)
Option --Default message <required> reason <required> report_opts {}. message => Log::Report::Message
. reason => REASON
. report_opts => HASH
$obj->message
$obj->reason
$obj->report_opts
$obj->inClass(CLASS|REGEX)
Check whether any of the classes listed in the message match CLASS (string) or the REGEX. This uses Log::Report::Message::inClass().
$obj->throw(OPTIONS)
Insert the message contained in the exception into the currently defined dispatchers. The
throwname is commonly known exception related terminology forreport.The OPTIONS overrule the captured options to Log::Report::report(). This can be used to overrule a destination. Also, the reason can be changed.
example: overrule defaults to report
try { print {to => 'stderr'}, ERROR => 'oops!' }; $@->reportFatal(to => 'syslog');

This module is part of Log-Report distribution version 0.24, built on April 27, 2009. Website: http://perl.overmeer.net/log-report/

Copyrights 2007-2009 by Mark Overmeer. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html