line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
3
|
|
|
|
|
|
|
package Email::Folder::Maildir; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$Email::Folder::Maildir::VERSION = '0.858'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
# ABSTRACT: reads raw RFC822 mails from a maildir |
8
|
1
|
|
|
1
|
|
7
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
85
|
|
9
|
1
|
|
|
1
|
|
1087
|
use IO::File; |
|
1
|
|
|
|
|
11112
|
|
|
1
|
|
|
|
|
178
|
|
10
|
1
|
|
|
1
|
|
684
|
use Email::Folder::Reader; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
64
|
|
11
|
1
|
|
|
1
|
|
888
|
use parent 'Email::Folder::Reader'; |
|
1
|
|
|
|
|
277
|
|
|
1
|
|
|
|
|
6
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _what_is_there { |
15
|
1
|
|
|
1
|
|
1
|
my $self = shift; |
16
|
1
|
|
|
|
|
2
|
my $dir = $self->{_file}; |
17
|
|
|
|
|
|
|
|
18
|
1
|
50
|
|
|
|
20
|
croak "$dir does not exist" unless (-e $dir); |
19
|
1
|
50
|
|
|
|
11
|
croak "$dir is not a maildir" unless (-d $dir); |
20
|
1
|
50
|
33
|
|
|
26
|
croak "$dir is not a maildir" unless (-e "$dir/cur" && -d "$dir/cur"); |
21
|
1
|
50
|
33
|
|
|
25
|
croak "$dir is not a maildir" unless (-e "$dir/new" && -d "$dir/new"); |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
1
|
my @messages; |
24
|
|
|
|
|
|
|
# ignore the tmp directory although the spec |
25
|
|
|
|
|
|
|
# says to delete anything in tmp/ that is older than 36 hours |
26
|
1
|
|
|
|
|
2
|
for my $sub (qw(new cur)) { |
27
|
2
|
50
|
|
|
|
70
|
opendir(DIR,"$dir/$sub") or croak "Could not open '$dir/$sub'"; |
28
|
2
|
|
|
|
|
30
|
foreach my $file (readdir DIR) { |
29
|
14
|
100
|
|
|
|
31
|
next if $file =~ /^\./; # as suggested by DJB |
30
|
10
|
|
|
|
|
28
|
push @messages, "$dir/$sub/$file"; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
5
|
$self->{_messages} = \@messages; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub next_message { |
38
|
11
|
|
|
11
|
1
|
13
|
my $self = shift; |
39
|
11
|
|
66
|
|
|
33
|
my $what = $self->{_messages} || $self->_what_is_there; |
40
|
|
|
|
|
|
|
|
41
|
11
|
100
|
|
|
|
26
|
my $file = shift @$what or return; |
42
|
10
|
|
|
|
|
18
|
local *FILE; |
43
|
10
|
50
|
|
|
|
329
|
open FILE, $file or croak "couldn't open '$file' for reading"; |
44
|
10
|
|
|
|
|
643
|
join '', ; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |