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.27
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 SYNOPSIS
29 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 · send_email(%p)
58
59 This is the method that must be subclassed. For now the only
60 parameter in the hash is 'message'.
61
62 · flush
63
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
66 clear the buffer.
67
68 · DESTROY
69
70 On destruction, the object will call "flush()" to send any pending
71 email.
72
74 Dave Rolsky <autarch@urth.org>
75
77 This software is Copyright (c) 2010 by Dave Rolsky.
78
79 This is free software, licensed under:
80
81 The Artistic License 2.0
82
83
84
85perl v5.12.2 2010-10-16 Log::Dispatch::Email(3)