Log::Handler::Output::Forward(3pm)

Log::Handler::Output::Forward3pm

Forward messages to routines.

Usage

    use Log::Handler::Output::Forward;
    my $forwarder = Log::Handler::Output::Forward->new(
        forward_to => sub { },
        arguments  => [ "foo" ],
    );
    $forwarder->log(message => $message);

Overview

This output module makes it possible to forward messages to sub routines.

Methods

new()

Call "new()" to create a new Log::Handler::Output::Forward object.

The following options are possible:

forward_to

This option excepts a code reference.

Please note that the message is forwarded as a hash reference. If you change it then this would have an effect to all outputs.

arguments

With this option you can define arguments that will be passed to the sub routine.

In the following 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);

If this option is not set then the message will be passed as first argument.

log()

Call "log()" if you want to forward messages to the subroutines.

Example:

    $forwarder->log("this message will be forwarded to all sub routines");

validate()

Validate a configuration.

reload()

Reload with a new configuration.

errstr()

This function returns the last error message.

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.

The hash key "message" contains the message.

Prerequisites

    Carp
    Params::Validate

Exports

No exports.

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.

Releases

9 releases since Debian 5.0 (Lenny); the text changed 6 times.

  1. 5.0
  2. 6.0
  3. 7
  4. 8
  5. 9–10
  6. 11
  7. 12–13

Author

Jonny Schulz <jschulz.cpan(at)bloonix.de>.

From liblog-handler-perl 0.90-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.