Log::H...Forward(3pm)
π Log::Handler::Output::Forward π
okay bestie, so this is a 3pm Perl module page β part of the Log::Handler squad β and it's literally just a lil messenger that forwards your log messages to a subroutine. That's it. That's the whole vibe. β¨
πΈ NAME πΈ
Log::Handler::Output::Forward β forward messages to routines. fr fr, that's the entire job description. π
β¨ SYNOPSIS β¨
here's the whole thing in action, no notes:
use Log::Handler::Output::Forward;
my $forwarder = Log::Handler::Output::Forward->new(
forward_to => sub { },
arguments => [ "foo" ],
);
$forwarder->log(message => $message);
that's it. that's the plot. π«Ά
π¦ DESCRIPTION π¦
so this output module makes it possible to forward messages to sub routines. that's the whole point of it existing. it catches your messages and just, like, hands them off to whatever code ref you told it to hand them off to. main character energy tbh. π
π METHODS π
π new()
call new() to create a new Log::Handler::Output::Forward object. iconic. here are the options you can pass it:
forward_toβ this option excepts a code reference. (yes, the original says "excepts", we keep the facts, we keep the typo, we move on π)
β οΈ please note that the message is forwarded as a hash reference. if you change it then this would have an effect to all outputs. so like, don't go editing it unless you mean to, bestie. π
argumentsβ with this option you can define arguments that will be passed to the sub routine.
in this next example the arguments would be passed as a array to Class::method():
my $forwarder = Log::Handler::Output::Forward->new(
forward_to => \&Class::method,
arguments => [ $self, "foo" ],
);
this would call intern:
Class::method(@arguments, $message);
and if this option is not set, then the message will be passed as first argument. simple as. β
π log()
call log() if you want to forward messages to the subroutines. that's the moment. the slay moment.
Example:
$forwarder->log("this message will be forwarded to all sub routines");
π validate()
validate a configuration. (yes queen, check that config before you commit to it)
π§ reload()
reload with a new configuration. glow-up but for settings.
π errstr()
this function returns the last error message. so when something goes wrong you can go π and ask it.
π FORWARDED MESSAGE π
note that the message will be forwarded as a hash reference.
if you make changes to the reference it affects all other outputs. (say it with me: shared state is a group project and everyone gets the consequences π)
the hash key message contains the message.
π PREREQUISITES π
Carp
Params::Validate
π EXPORTS π
no exports. nothing. zero. we keep it minimal bestie. π
π REPORT BUGS π
please report all bugs to <jschulz.cpan(at)bloonix.de>.
if you send me a mail then add Log::Handler into the subject. (subject line matters, iykyk π§)
πΈ AUTHOR πΈ
Jonny Schulz <jschulz.cpan(at)bloonix.de>.
π COPYRIGHT π
Copyright (C) 2007-2009 by Jonny Schulz. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, bestie π«Ά this one's perl v5.36.0, dated 2022-08-28, from the Log::H...Forward(3pm) corner of the manual. go forth and forward your messages responsibly π
β¨
π¦ where this page comes from
- ubuntu noble: liblog-handler-perl 0.90-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: liblog-handler-perl 0.90-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: liblog-handler-perl 0.90-2 Β· 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