| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
807
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
38
|
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
57
|
|
|
3
|
|
|
|
|
|
|
package Email::Folder::IMAP; |
|
4
|
|
|
|
|
|
|
# ABSTRACT: Email::Folder Access to IMAP Folders |
|
5
|
|
|
|
|
|
|
$Email::Folder::IMAP::VERSION = '1.105'; |
|
6
|
1
|
|
|
1
|
|
736
|
use parent qw[Email::Folder::Reader]; |
|
|
1
|
|
|
|
|
276
|
|
|
|
1
|
|
|
|
|
5
|
|
|
7
|
1
|
|
|
1
|
|
1913
|
use Net::IMAP::Simple 0.95; # :port support |
|
|
1
|
|
|
|
|
62390
|
|
|
|
1
|
|
|
|
|
36
|
|
|
8
|
1
|
|
|
1
|
|
2761
|
use URI; |
|
|
1
|
|
|
|
|
4350
|
|
|
|
1
|
|
|
|
|
6464
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub _imap_class { |
|
11
|
0
|
|
|
0
|
|
|
'Net::IMAP::Simple'; |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _uri { |
|
15
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
16
|
0
|
|
0
|
|
|
|
return $self->{_uri} ||= URI->new($self->{_file}); |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _server { |
|
20
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
21
|
0
|
0
|
|
|
|
|
return $self->{_server} if $self->{_server}; |
|
22
|
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my $uri = $self->_uri; |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $host = $uri->host_port; |
|
26
|
0
|
|
|
|
|
|
my $server = $self->_imap_class->new($host); |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my ($user, $pass) = @{$self}{qw[username password]}; |
|
|
0
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
($user, $pass) = split ':', $uri->userinfo, 2 unless $user; |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
$server->login($user, $pass) if $user; |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $box = substr $uri->path, 1; |
|
34
|
0
|
0
|
|
|
|
|
$server->select($box) if $box; |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
$self->{_next} = 1; |
|
37
|
0
|
|
|
|
|
|
return $self->{_server} = $server; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub next_message { |
|
41
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
42
|
0
|
|
|
|
|
|
my $message = $self->_server->get($self->{_next}); |
|
43
|
0
|
0
|
|
|
|
|
if ($message) { |
|
44
|
0
|
|
|
|
|
|
++$self->{_next}; |
|
45
|
0
|
|
|
|
|
|
return join '', @{$message}; |
|
|
0
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
|
47
|
0
|
|
|
|
|
|
$self->{_next} = 1; |
|
48
|
0
|
|
|
|
|
|
return; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
|
54
|
|
|
|
|
|
|
#pod |
|
55
|
|
|
|
|
|
|
#pod use Email::Folder; |
|
56
|
|
|
|
|
|
|
#pod use Email::FolderType::Net; |
|
57
|
|
|
|
|
|
|
#pod |
|
58
|
|
|
|
|
|
|
#pod my $folder = Email::Folder->new('imap://example.com'); # read INBOX |
|
59
|
|
|
|
|
|
|
#pod |
|
60
|
|
|
|
|
|
|
#pod print $_->header('Subject') for $folder->messages; |
|
61
|
|
|
|
|
|
|
#pod |
|
62
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
|
63
|
|
|
|
|
|
|
#pod |
|
64
|
|
|
|
|
|
|
#pod This software adds IMAP functionality to L. |
|
65
|
|
|
|
|
|
|
#pod Its interface is identical to the other |
|
66
|
|
|
|
|
|
|
#pod L subclasses. |
|
67
|
|
|
|
|
|
|
#pod |
|
68
|
|
|
|
|
|
|
#pod =head2 Parameters |
|
69
|
|
|
|
|
|
|
#pod |
|
70
|
|
|
|
|
|
|
#pod C and C parameters may be sent to C. If |
|
71
|
|
|
|
|
|
|
#pod used, they override any user info passed in the connection URI. |
|
72
|
|
|
|
|
|
|
#pod |
|
73
|
|
|
|
|
|
|
#pod =head2 Folder Specification |
|
74
|
|
|
|
|
|
|
#pod |
|
75
|
|
|
|
|
|
|
#pod Folders are specified using a simplified form of the IMAP URL Scheme |
|
76
|
|
|
|
|
|
|
#pod detailed in RFC 2192. Not all of that specification applies. Here |
|
77
|
|
|
|
|
|
|
#pod are a few examples. |
|
78
|
|
|
|
|
|
|
#pod |
|
79
|
|
|
|
|
|
|
#pod Selecting the INBOX. |
|
80
|
|
|
|
|
|
|
#pod |
|
81
|
|
|
|
|
|
|
#pod imap://foo.com |
|
82
|
|
|
|
|
|
|
#pod |
|
83
|
|
|
|
|
|
|
#pod Selecting the INBOX using URI based authentication. Remember that the |
|
84
|
|
|
|
|
|
|
#pod C and C parameters passed to C will override |
|
85
|
|
|
|
|
|
|
#pod anything set in the URI. |
|
86
|
|
|
|
|
|
|
#pod |
|
87
|
|
|
|
|
|
|
#pod imap://user:pass@foo.com |
|
88
|
|
|
|
|
|
|
#pod |
|
89
|
|
|
|
|
|
|
#pod Selecting the p5p list. |
|
90
|
|
|
|
|
|
|
#pod |
|
91
|
|
|
|
|
|
|
#pod imap://foo.com/perl/perl5-porters |
|
92
|
|
|
|
|
|
|
#pod |
|
93
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
|
94
|
|
|
|
|
|
|
#pod |
|
95
|
|
|
|
|
|
|
#pod L, |
|
96
|
|
|
|
|
|
|
#pod L, |
|
97
|
|
|
|
|
|
|
#pod L, |
|
98
|
|
|
|
|
|
|
#pod L, |
|
99
|
|
|
|
|
|
|
#pod L. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__END__ |