1Log::Dispatch::Email(3)User Contributed Perl DocumentatioLnog::Dispatch::Email(3)
2
3
4
6 Log::Dispatch::Email - Base class for objects that send log messages
7 via email
8
10 version 2.70
11
13 package Log::Dispatch::Email::MySender;
14
15 use Log::Dispatch::Email;
16 use base qw( Log::Dispatch::Email );
17
18 sub send_email {
19 my $self = shift;
20 my %p = @_;
21
22 # Send email somehow. Message is in $p{message}
23 }
24
26 This module should be used as a base class to implement
27 Log::Dispatch::* objects that send their log messages via email.
28 Implementing a subclass simply requires the code shown in the
29 "SYNOPSIS" with a real implementation of the "send_email()" method.
30
32 The constructor takes the following parameters in addition to the
33 standard parameters documented in Log::Dispatch::Output:
34
35 • subject ($)
36
37 The subject of the email messages which are sent. Defaults to "$0:
38 log email"
39
40 • to ($ or \@)
41
42 Either a string or a list reference of strings containing email
43 addresses. Required.
44
45 • from ($)
46
47 A string containing an email address. This is optional and may not
48 work with all mail sending methods.
49
50 • buffered (0 or 1)
51
52 This determines whether the object sends one email per message it
53 is given or whether it stores them up and sends them all at once.
54 The default is to buffer messages.
55
57 This class provides the following methods:
58
59 $email->send_email(%p)
60 This is the method that must be subclassed. For now the only parameter
61 in the hash is 'message'.
62
63 $email->flush
64 If the object is buffered, then this method will call the
65 "send_email()" method to send the contents of the buffer and then clear
66 the buffer.
67
68 $email->DESTROY
69 On destruction, the object will call "flush()" to send any pending
70 email.
71
73 Bugs may be submitted at
74 <https://github.com/houseabsolute/Log-Dispatch/issues>.
75
76 I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
77
79 The source code repository for Log-Dispatch can be found at
80 <https://github.com/houseabsolute/Log-Dispatch>.
81
83 Dave Rolsky <autarch@urth.org>
84
86 This software is Copyright (c) 2020 by Dave Rolsky.
87
88 This is free software, licensed under:
89
90 The Artistic License 2.0 (GPL Compatible)
91
92 The full text of the license can be found in the LICENSE file included
93 with this distribution.
94
95
96
97perl v5.32.1 2021-01-27 Log::Dispatch::Email(3)