1Log::Handler::Output::FUosrewrarCdo(n3t)ributed Perl DocLuomge:n:tHaatnidolner::Output::Forward(3)
2
3
4
6 Log::Handler::Output::Forward - Forward messages to routines.
7
9 use Log::Handler::Output::Forward;
10
11 my $forwarder = Log::Handler::Output::Forward->new(
12 forward_to => sub { },
13 arguments => [ "foo" ],
14 );
15
16 $forwarder->log(message => $message);
17
19 This output module makes it possible to forward messages to sub
20 routines.
21
23 new()
24 Call "new()" to create a new Log::Handler::Output::Forward object.
25
26 The following options are possible:
27
28 forward_to
29 This option excepts a code reference.
30
31 Please note that the message is forwarded as a hash reference. If
32 you change it then this would have an effect to all outputs.
33
34 arguments
35 With this option you can define arguments that will be passed to
36 the sub routine.
37
38 In the following example the arguments would be passed as a array
39 to "Class::method()".
40
41 my $forwarder = Log::Handler::Output::Forward->new(
42 forward_to => \&Class::method,
43 arguments => [ $self, "foo" ],
44 );
45
46 This would call intern:
47
48 Class::method(@arguments, $message);
49
50 If this option is not set then the message will be passed as first
51 argument.
52
53 log()
54 Call "log()" if you want to forward messages to the subroutines.
55
56 Example:
57
58 $forwarder->log("this message will be forwarded to all sub routines");
59
60 validate()
61 Validate a configuration.
62
63 reload()
64 Reload with a new configuration.
65
66 errstr()
67 This function returns the last error message.
68
70 Note that the message will be forwarded as a hash reference.
71
72 If you make changes to the reference it affects all other outputs.
73
74 The hash key "message" contains the message.
75
77 Carp
78 Params::Validate
79
81 No exports.
82
84 Please report all bugs to <jschulz.cpan(at)bloonix.de>.
85
86 If you send me a mail then add Log::Handler into the subject.
87
89 Jonny Schulz <jschulz.cpan(at)bloonix.de>.
90
92 Copyright (C) 2007-2009 by Jonny Schulz. All rights reserved.
93
94 This program is free software; you can redistribute it and/or modify it
95 under the same terms as Perl itself.
96
97
98
99perl v5.32.0 2020-07-28 Log::Handler::Output::Forward(3)