The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Log::Report::Dispatcher::Try - capture all reports as exceptions

INHERITANCE

 Log::Report::Dispatcher::Try
   is a Log::Report::Dispatcher

SYNOPSIS

 try { ... }
 print ref $@;  # Log::Report::Dispatcher::Try

DESCRIPTION

METHODS

Constructors

$obj->close

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

Log::Report::Dispatcher::Try->new(TYPE, NAME, OPTIONS)

     Option    --Defined in     --Default
     accept      Log::Report::Dispatcher  depend on mode
     died                         undef
     exceptions                   []
     locale      Log::Report::Dispatcher  <system locale>
     mode        Log::Report::Dispatcher  'NORMAL'

    . accept => REASONS

    . died => STRING

      The exit string ($@) of the eval'ed block.

    . exceptions => ARRAY-of-EXCEPTIONS

    . locale => LOCALE

    . mode => 'NORMAL'|'VERBOSE'|'ASSERT'|'DEBUG'|0..3

Accessors

$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->isDisabled

$obj->mode

$obj->name

$obj->needs

$obj->type

Logging

$obj->collectLocation

$obj->collectStack([MAXDEPTH])

$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

    Re-cast the messages in all collect exceptions into the defined dispatchers, which were disabled during the try block.

$obj->reportFatal

    Re-cast only the fatal message to the defined dispatchers. If the block was left without problems, then nothing will be done.

$obj->stackTraceLine(OPTIONS)

Log::Report::Dispatcher::Try->stackTraceLine(OPTIONS)

$obj->translate(HASH-of-OPTIONS, REASON, MESSAGE)

Status

$obj->failed

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

$obj->printError

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

$obj->success

    Returns true if the block exited normally.

$obj->wasFatal

DETAILS

SEE ALSO

This module is part of Log-Report distribution version 0.02, built on May 28, 2007. Website: http://perl.overmeer.net/log-report/

LICENSE

Copyrights 2007 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