line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
36786
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
48
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
166
|
|
3
|
|
|
|
|
|
|
package Email::LocalDelivery; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$Email::LocalDelivery::VERSION = '1.200'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
# ABSTRACT: Deliver a piece of email - simply |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
982
|
use File::Path::Expand 1.01 qw(expand_filename); |
|
1
|
|
|
|
|
13555
|
|
|
1
|
|
|
|
|
69
|
|
10
|
1
|
|
|
1
|
|
728
|
use Email::FolderType 0.7 qw(folder_type); |
|
1
|
|
|
|
|
12385
|
|
|
1
|
|
|
|
|
67
|
|
11
|
1
|
|
|
1
|
|
11
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
317
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub deliver { |
15
|
1
|
|
|
1
|
1
|
1069
|
my ($class, $mail, @boxes) = @_; |
16
|
|
|
|
|
|
|
|
17
|
1
|
50
|
|
|
|
8
|
croak "Mail argument to deliver should just be a plain string" |
18
|
|
|
|
|
|
|
if ref $mail; |
19
|
|
|
|
|
|
|
|
20
|
1
|
50
|
|
|
|
9
|
if (!@boxes) { |
21
|
0
|
|
|
|
|
0
|
my $default_maildir = (getpwuid($>))[7] . "/Maildir/"; |
22
|
0
|
|
|
|
|
0
|
my $default_unixbox |
23
|
0
|
|
|
|
|
0
|
= (grep { -d $_ } qw(/var/spool/mail/ /var/mail/))[0] |
24
|
|
|
|
|
|
|
. getpwuid($>); |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
0
|
|
|
0
|
@boxes = $ENV{MAIL} |
27
|
|
|
|
|
|
|
|| (-e $default_unixbox && $default_unixbox) |
28
|
|
|
|
|
|
|
|| (-d $default_maildir."cur" && $default_maildir); |
29
|
|
|
|
|
|
|
} |
30
|
1
|
|
|
|
|
8
|
my %to_deliver; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
93
|
for my $box (@boxes) { |
33
|
1
|
|
|
|
|
10
|
$box = expand_filename($box); |
34
|
1
|
|
|
|
|
15
|
push @{$to_deliver{folder_type($box)}}, $box; |
|
1
|
|
|
|
|
9
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
11021
|
my @rv; |
38
|
1
|
|
|
|
|
5
|
for my $method (keys %to_deliver) { |
39
|
1
|
|
|
|
|
73
|
eval "require Email::LocalDelivery::$method"; |
40
|
1
|
50
|
|
|
|
11
|
croak "Couldn't load a module to handle $method mailboxes" if $@; |
41
|
1
|
|
|
|
|
11
|
push @rv, |
42
|
|
|
|
|
|
|
"Email::LocalDelivery::$method"->deliver($mail, |
43
|
1
|
|
|
|
|
5
|
@{$to_deliver{$method}}); |
44
|
|
|
|
|
|
|
} |
45
|
1
|
|
|
|
|
9
|
return @rv; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |