| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
3
|
|
|
3
|
|
17
|
use strict; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
99
|
|
|
2
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
171
|
|
|
3
|
|
|
|
|
|
|
package Email::Folder::Reader; |
|
4
|
|
|
|
|
|
|
# ABSTRACT: reads raw RFC822 mails from a box |
|
5
|
|
|
|
|
|
|
$Email::Folder::Reader::VERSION = '0.859'; |
|
6
|
3
|
|
|
3
|
|
15
|
use Carp; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
634
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
|
9
|
|
|
|
|
|
|
#pod |
|
10
|
|
|
|
|
|
|
#pod use Email::Folder::Reader; |
|
11
|
|
|
|
|
|
|
#pod my $box = Email::Folder::Reader->new('somebox'); |
|
12
|
|
|
|
|
|
|
#pod print $box->messages; |
|
13
|
|
|
|
|
|
|
#pod |
|
14
|
|
|
|
|
|
|
#pod or, as an iterator |
|
15
|
|
|
|
|
|
|
#pod |
|
16
|
|
|
|
|
|
|
#pod use Email::Folder::Reader; |
|
17
|
|
|
|
|
|
|
#pod my $box = Email::Folder::Reader->new('somebox'); |
|
18
|
|
|
|
|
|
|
#pod while ( my $mail = $box->next_message ) { |
|
19
|
|
|
|
|
|
|
#pod print $mail; |
|
20
|
|
|
|
|
|
|
#pod } |
|
21
|
|
|
|
|
|
|
#pod |
|
22
|
|
|
|
|
|
|
#pod =head1 METHODS |
|
23
|
|
|
|
|
|
|
#pod |
|
24
|
|
|
|
|
|
|
#pod =head2 new($filename, %options) |
|
25
|
|
|
|
|
|
|
#pod |
|
26
|
|
|
|
|
|
|
#pod your standard class-method constructor |
|
27
|
|
|
|
|
|
|
#pod |
|
28
|
|
|
|
|
|
|
#pod =cut |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub new { |
|
31
|
11
|
|
|
11
|
1
|
23
|
my $class = shift; |
|
32
|
11
|
|
33
|
|
|
91
|
my $file = shift || croak "You must pass a filename"; |
|
33
|
11
|
|
|
|
|
22
|
bless { eval { $class->defaults }, |
|
|
11
|
|
|
|
|
103
|
|
|
34
|
|
|
|
|
|
|
@_, |
|
35
|
|
|
|
|
|
|
_file => $file }, $class; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#pod =head2 ->next_message |
|
39
|
|
|
|
|
|
|
#pod |
|
40
|
|
|
|
|
|
|
#pod returns the next message from the box, or false if there are no more |
|
41
|
|
|
|
|
|
|
#pod |
|
42
|
|
|
|
|
|
|
#pod =cut |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
1
|
0
|
sub next_message { |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
#pod =head2 ->messages |
|
48
|
|
|
|
|
|
|
#pod |
|
49
|
|
|
|
|
|
|
#pod Returns all the messages in a box |
|
50
|
|
|
|
|
|
|
#pod |
|
51
|
|
|
|
|
|
|
#pod =cut |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub messages { |
|
54
|
9
|
|
|
9
|
1
|
20
|
my $self = shift; |
|
55
|
|
|
|
|
|
|
|
|
56
|
9
|
|
|
|
|
15
|
my @messages; |
|
57
|
9
|
|
|
|
|
38
|
while (my $message = $self->next_message) { |
|
58
|
52
|
|
|
|
|
260
|
push @messages, $message; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
9
|
|
|
|
|
69
|
return @messages; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |