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