METHODS

Constructors

$obj->close

Only when initiated with a FILENAME, the file will be closed. In any other case, nothing will be done.

$class->new( $type, $name, %options )
Option Defined in Default

accept

Log::Report::Dispatcher

depend on mode

charset

Log::Report::Dispatcher

<undef>

died

undef

exceptions

[]

format_reason

Log::Report::Dispatcher

'LOWERCASE'

hide

'NONE'

locale

Log::Report::Dispatcher

<system locale>

mode

Log::Report::Dispatcher

'NORMAL'

on_die

'ERROR'

accept => REASONS
charset => CHARSET
died => STRING
The exit string ($@) of the eval'ed block.
exceptions => ARRAY
ARRAY of Log::Report::Exception objects.
format_reason => 'UPPERCASE'|'LOWERCASE'|'UCFIRST'|'IGNORE'|CODE
hide => REASON|ARRAY|'ALL'|'NONE'
[1.09] see hide()
locale => LOCALE
mode => 'NORMAL'|'VERBOSE'|'ASSERT'|'DEBUG'|0..3
on_die => 'ERROR'|'PANIC'
When code which runs in this block exits with a die(), it will get translated into a Log::Report::Exception using Log::Report::Die::die_decode(). How serious are we about these errors?

Accessors

$obj->die2reason

Returns the value of M

$obj->died( [STRING] )

The message which was reported by eval, which is used internally to catch problems in the try block.

$obj->exceptions

Returns all collected Log::Report::Exceptions. The last of them may be a fatal one. The other are non-fatal.

$obj->hide( REASON|REASONS|ARRAY|'ALL'|'NONE' )

[1.09] By default, the try will only catch messages which stop the execution of the block (errors etc, internally a 'die'). Other messages are passed to parent try blocks, if none than to the dispatchers.

This option gives the opportunity to block, for instance, trace messages. Those messages are still collected inside the try object, so may get passed-on later via reportAll() if you like.

Be warned: Using this method will reset the whole 'hide' configuration: it's a set not an add.

» Example: change the setting of the running block
  my $parent_try = dispatcher 'active-try';
  parent_try->hide('NONE');
$obj->hides( REASON )
$obj->isDisabled
See isDisabled in Log::Report::Dispatcher.
$obj->mode
See mode in Log::Report::Dispatcher.
$obj->name
See name in Log::Report::Dispatcher.
$obj->needs( [$reason] )
See needs in Log::Report::Dispatcher.
$obj->type
See type in Log::Report::Dispatcher.

Logging

$obj->addSkipStack( @CODE )
$class->addSkipStack( @CODE )
See addSkipStack in Log::Report::Dispatcher.
$obj->collectLocation
$class->collectLocation
See collectLocation in Log::Report::Dispatcher.
$obj->collectStack( [$maxdepth] )
$class->collectStack( [$maxdepth] )
See collectStack in Log::Report::Dispatcher.
$obj->log( $opts, $reason, $message )

Other dispatchers translate the message here, and make it leave the program. However, messages in a "try" block are only captured in an intermediate layer: they may never be presented to an end-users. And for sure, we do not know the language yet.

The $message is either a STRING or a Log::Report::Message.

$obj->reportAll( %options )

Re-cast the messages in all collect exceptions into the defined dispatchers, which were disabled during the try block. The %options will end-up as HASH of %options to Log::Report::report(); see Log::Report::Exception::throw() which does the job.

$obj->reportFatal

Re-cast only the fatal message to the defined dispatchers. If the block was left without problems, then nothing will be done. The %options will end-up as HASH of %options to Log::Report::report(); see Log::Report::Exception::throw() which does the job.

$obj->skipStack
See skipStack in Log::Report::Dispatcher.
$obj->stackTraceLine( %options )
$class->stackTraceLine( %options )
See stackTraceLine in Log::Report::Dispatcher.
$obj->translate( HASH-$of-%options, $reason, $message )
See translate in Log::Report::Dispatcher.

Status

$obj->failed

Returns true if the block was left with an fatal message.

$obj->showStatus

If this object is kept in $@, and someone uses this as string, we want to show the fatal error message.

The message is not very informative for the good cause: we do not want people to simply print the $@, but wish for a re-cast of the message using reportAll() or reportFatal().

$obj->success

Returns true if the block exited normally.

$obj->wasFatal( %options )

Returns the Log::Report::Exception which caused the "try" block to die, otherwise an empty LIST (undef).

Option Default

class

undef

class => CLASS|REGEX
Only return the exception if it was fatal, and in the same time in the specified CLASS (as string) or matches the REGEX. See Log::Report::Message::inClass()