Log::R...eption(3pm)
β¨ NAME β¨
Log::Report::Exception β a single generated event π (bestie, it's one exception object, one lil' moment in time, no cap)
it lives in the Log::R...eption(3pm) page, and this? this is the User Contributed Perl Documentation for it, so you KNOW it's giving community-maintained energy π«Ά
πΈ SYNOPSIS πΈ
# 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->taggedWith('die')) ...
if($exception->taggedWith('die')) ... # same
if($@->wasFatal(tag => 'die')) ... # same
okay so literally every one of those lines is doing the same kinda thing and i need you to see it π₯
π DESCRIPTION π
So in Log::Report, exceptions are not as extended as what you get in languages like Java β like, you do not go around making classes for them, that's not the vibe. π
The only thing an exception object does is capture some information about an (untranslated) report. That's it. That's the whole job. main character, minimal plot π
π OVERLOADED π
- overload:
""stringification β produces"reason: message"viatoString(). so if you just print the thing, you get the reason, colon, space, message. slay β¨ - overload:
boolboolean condition β always returns"true", because hello?? the exception object exists?? the object is the truth. periodt π
π METHODS π
π§ Constructors
$class->new(%options)β create a new exception object, which is basically a"message"that was produced for a"reason". so: message + reason = exception. iconic math π
-Option --Default
message <required>
reason <required>
report_opts +{ }
message => Log::Report::Messagereason => $reasonreport_opts => \%opts
π¦ Attributes
$obj->isFatal()β returns whether this exception has a severity which makes it fatal when thrown.[1.34]this can have been overruled with the"is_fatal"attribute. seeLog::Report::Util::is_fatal().
Β» example:
if($ex->isFatal) { $ex->throw(reason => 'ALERT') }
else { $ex->throw }
$obj->message( [$message] )β change the$messageof the exception, which must be aLog::Report::Messageobject.
when you use a "Log::Report::Message" object, you will get a new one returned. so bestie, listen: if you wanna modify the message inside an exception, you have to re-assign the result of the modification. no in-place glow-up here, we do not have that π₯²
Β» example:
$e->message->concat('!!')); # will not work!
$e->message($e->message->concat('!!'));
$e->message(__x"some message {xyz}", xyz => $xyz);
$obj->reason( [$reason] )$obj->report_opts()
β Processing
$obj->inClass($tag|Regexp)β deprecated name fortaggedWith(). it's giving legacy, it's giving "we still support it but pls move on" π$obj->print( [$fh] )β the default filehandle isSTDOUT.
Β» example:
print $exception; # via overloading
$exception->print; # OO style
$obj->taggedWith($tag|Regexp)β[1.44]check whether any of the classes listed in the message match$tag(a string) or the Regexp. this usesLog::Report::Message::taggedWith().$obj->throw(%options)β insert the message contained in the exception into the currently defined dispatchers. the"throw"as a method name is commonly known exception-related terminology for"report". iykyk π₯
the %options overrule the captured options to Log::Report::report(). this can be used to overrule a destination. also, the reason can be changed.
returned is the LIST of dispatchers which have accepted the forwarded exception. yes queen, you get a list back π
Β» example: overrule defaults to report
try { report {to => 'default'}, ERROR => 'oops!' };
$@->reportFatal(to => 'syslog');
my ($syslog) = $exception->throw(to => 'syslog');
my @disps = $@->wasFatal->throw(reason => 'WARNING');
$obj->toHTML( [$locale] )β[1.11]callstoString()and then escapes HTML volatile characters. safety first, bestie πΈ$obj->toString( [$locale] )β prints the reason and the message. differently fromthrow(), this only represents the textual content: it does not re-cast the exceptions to higher levels. so it's the lowkey, chill version π
Β» example: printing exceptions
print $_->toString for $@->exceptions;
print $_ for $@->exceptions; # via overloading
π DIAGNOSTICS π
- Error:
message()of exception expects Log::Report::Message, got$what. β cast bymessage(). yeah you handed it the wrong thing, it's gonna tell you π
π SEE ALSO π
This module is part of Log-Report version 1.46, built on June 16, 2026.
Website: http://perl.overmeer.net/CPAN/
π LICENSE π
For contributors see file ChangeLog.
This software is copyright (c) 2007-2026 by Mark Overmeer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay and that's the whole page, bestie!! π you read the entire thing, we are SO proud of you π«Ά this was perl v5.40.1, dated 2026-07-05 β go forth and throw responsibly πβ¨
π¦ where this page comes from
- ubuntu stonking: liblog-report-perl 1.46-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms