| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
48082
|
use strict; |
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
22
|
|
|
2
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
47
|
|
|
3
|
|
|
|
|
|
|
package Email::LocalDelivery 1.201; |
|
4
|
|
|
|
|
|
|
# ABSTRACT: Deliver a piece of email - simply |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
284
|
use File::Path::Expand 1.01 qw(expand_filename); |
|
|
1
|
|
|
|
|
5165
|
|
|
|
1
|
|
|
|
|
43
|
|
|
7
|
1
|
|
|
1
|
|
292
|
use Email::FolderType 0.7 qw(folder_type); |
|
|
1
|
|
|
|
|
9994
|
|
|
|
1
|
|
|
|
|
40
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
197
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
|
11
|
|
|
|
|
|
|
#pod |
|
12
|
|
|
|
|
|
|
#pod use Email::LocalDelivery; |
|
13
|
|
|
|
|
|
|
#pod my @delivered_to = Email::LocalDelivery->deliver($mail, @boxes); |
|
14
|
|
|
|
|
|
|
#pod |
|
15
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
|
16
|
|
|
|
|
|
|
#pod |
|
17
|
|
|
|
|
|
|
#pod This module delivers an email to a list of mailboxes. |
|
18
|
|
|
|
|
|
|
#pod |
|
19
|
|
|
|
|
|
|
#pod B You might be better off looking at L, and at |
|
20
|
|
|
|
|
|
|
#pod L and L. |
|
21
|
|
|
|
|
|
|
#pod They are heavily used and more carefully monitored. |
|
22
|
|
|
|
|
|
|
#pod |
|
23
|
|
|
|
|
|
|
#pod =method deliver |
|
24
|
|
|
|
|
|
|
#pod |
|
25
|
|
|
|
|
|
|
#pod This takes an email, as a plain string, and a list of mailboxes to |
|
26
|
|
|
|
|
|
|
#pod deliver that mail to. It returns the list of boxes actually written to. |
|
27
|
|
|
|
|
|
|
#pod If no boxes are given, it assumes the standard Unix mailbox. (Either |
|
28
|
|
|
|
|
|
|
#pod C<$ENV{MAIL}>, F, F, or |
|
29
|
|
|
|
|
|
|
#pod F<~you/Maildir/>) |
|
30
|
|
|
|
|
|
|
#pod |
|
31
|
|
|
|
|
|
|
#pod =cut |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub deliver { |
|
34
|
1
|
|
|
1
|
1
|
97
|
my ($class, $mail, @boxes) = @_; |
|
35
|
|
|
|
|
|
|
|
|
36
|
1
|
50
|
|
|
|
4
|
croak "Mail argument to deliver should just be a plain string" |
|
37
|
|
|
|
|
|
|
if ref $mail; |
|
38
|
|
|
|
|
|
|
|
|
39
|
1
|
50
|
|
|
|
2
|
if (!@boxes) { |
|
40
|
0
|
|
|
|
|
0
|
my $default_maildir = (getpwuid($>))[7] . "/Maildir/"; |
|
41
|
|
|
|
|
|
|
my $default_unixbox |
|
42
|
0
|
|
|
|
|
0
|
= (grep { -d $_ } qw(/var/spool/mail/ /var/mail/))[0] |
|
|
0
|
|
|
|
|
0
|
|
|
43
|
|
|
|
|
|
|
. getpwuid($>); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
@boxes = $ENV{MAIL} |
|
46
|
0
|
|
0
|
|
|
0
|
|| (-e $default_unixbox && $default_unixbox) |
|
47
|
|
|
|
|
|
|
|| (-d $default_maildir."cur" && $default_maildir); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
1
|
|
|
|
|
2
|
my %to_deliver; |
|
50
|
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
2
|
for my $box (@boxes) { |
|
52
|
1
|
|
|
|
|
5
|
$box = expand_filename($box); |
|
53
|
1
|
|
|
|
|
7
|
push @{$to_deliver{folder_type($box)}}, $box; |
|
|
1
|
|
|
|
|
3
|
|
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
3600
|
my @rv; |
|
57
|
1
|
|
|
|
|
3
|
for my $method (keys %to_deliver) { |
|
58
|
1
|
|
|
|
|
39
|
eval "require Email::LocalDelivery::$method"; |
|
59
|
1
|
50
|
|
|
|
4
|
croak "Couldn't load a module to handle $method mailboxes" if $@; |
|
60
|
|
|
|
|
|
|
push @rv, |
|
61
|
|
|
|
|
|
|
"Email::LocalDelivery::$method"->deliver($mail, |
|
62
|
1
|
|
|
|
|
3
|
@{$to_deliver{$method}}); |
|
|
1
|
|
|
|
|
6
|
|
|
63
|
|
|
|
|
|
|
} |
|
64
|
1
|
|
|
|
|
4
|
return @rv; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__END__ |