line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Email::MIME::RFC2047::Group; |
2
|
|
|
|
|
|
|
$Email::MIME::RFC2047::Group::VERSION = '0.96'; |
3
|
4
|
|
|
4
|
|
32
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
257
|
|
4
|
4
|
|
|
4
|
|
29
|
use warnings; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
154
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Handling of MIME encoded mailbox groups |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
33
|
use base qw(Email::MIME::RFC2047::Address); |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
387
|
|
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
38
|
use Email::MIME::RFC2047::Decoder; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
119
|
|
11
|
4
|
|
|
4
|
|
1841
|
use Email::MIME::RFC2047::MailboxList; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
1291
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
9
|
|
|
9
|
1
|
51
|
my $class = shift; |
15
|
|
|
|
|
|
|
|
16
|
9
|
|
|
|
|
17
|
my $self; |
17
|
|
|
|
|
|
|
|
18
|
9
|
100
|
|
|
|
36
|
if (@_ >= 2) { |
19
|
7
|
|
|
|
|
27
|
$self = { @_ }; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
else { |
22
|
2
|
|
|
|
|
6
|
$self = $_[0]; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
9
|
|
|
|
|
54
|
return bless($self, $class); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#sub _parse { |
29
|
|
|
|
|
|
|
# my ($class, $string, $decoder) = @_; |
30
|
|
|
|
|
|
|
# my $string_ref = ref($string) ? $string : \$string; |
31
|
|
|
|
|
|
|
# |
32
|
|
|
|
|
|
|
# $decoder ||= Email::MIME::RFC2047::Decoder->new(); |
33
|
|
|
|
|
|
|
# |
34
|
|
|
|
|
|
|
# my $name = $decoder->decode_phrase($string_ref); |
35
|
|
|
|
|
|
|
# return $class->_parse_error($string_ref, 'group name') |
36
|
|
|
|
|
|
|
# if $name eq ''; |
37
|
|
|
|
|
|
|
# |
38
|
|
|
|
|
|
|
# $$string_ref =~ /\G:/cg |
39
|
|
|
|
|
|
|
# or return $class->_parse_error($string_ref, 'group'); |
40
|
|
|
|
|
|
|
# |
41
|
|
|
|
|
|
|
# my $mailbox_list; |
42
|
|
|
|
|
|
|
# |
43
|
|
|
|
|
|
|
# if ($$string_ref =~ /\G\s*;\s*/cg) { |
44
|
|
|
|
|
|
|
# $mailbox_list = Email::MIME::RFC2047::MailboxList->new(); |
45
|
|
|
|
|
|
|
# } |
46
|
|
|
|
|
|
|
# else { |
47
|
|
|
|
|
|
|
# $mailbox_list = Email::MIME::RFC2047::MailboxList->parse( |
48
|
|
|
|
|
|
|
# $string_ref, $decoder |
49
|
|
|
|
|
|
|
# ); |
50
|
|
|
|
|
|
|
# |
51
|
|
|
|
|
|
|
# $$string_ref =~ /\G;\s*/cg |
52
|
|
|
|
|
|
|
# or return $class->_parse_error($string_ref, 'group'); |
53
|
|
|
|
|
|
|
# } |
54
|
|
|
|
|
|
|
# |
55
|
|
|
|
|
|
|
# my $group = $class->new( |
56
|
|
|
|
|
|
|
# name => $name, |
57
|
|
|
|
|
|
|
# mailbox_list => $mailbox_list, |
58
|
|
|
|
|
|
|
# ); |
59
|
|
|
|
|
|
|
# |
60
|
|
|
|
|
|
|
# if (!ref($string) && pos($string) < length($string)) { |
61
|
|
|
|
|
|
|
# return $class->_parse_error($string_ref); |
62
|
|
|
|
|
|
|
# } |
63
|
|
|
|
|
|
|
# |
64
|
|
|
|
|
|
|
# return $group; |
65
|
|
|
|
|
|
|
#} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub name { |
68
|
2
|
|
|
2
|
1
|
17
|
my $self = shift; |
69
|
|
|
|
|
|
|
|
70
|
2
|
|
|
|
|
7
|
my $old_name = $self->{name}; |
71
|
2
|
50
|
|
|
|
7
|
$self->{name} = $_[0] if @_; |
72
|
|
|
|
|
|
|
|
73
|
2
|
|
|
|
|
18
|
return $old_name; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub mailbox_list { |
77
|
2
|
|
|
2
|
1
|
7
|
my $self = shift; |
78
|
|
|
|
|
|
|
|
79
|
2
|
|
|
|
|
5
|
my $old_mailbox_list = $self->{mailbox_list}; |
80
|
2
|
50
|
|
|
|
10
|
$self->{mailbox_list} = $_[0] if @_; |
81
|
|
|
|
|
|
|
|
82
|
2
|
|
|
|
|
17
|
return $old_mailbox_list; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub format { |
86
|
3
|
|
|
3
|
1
|
21
|
my ($self, $encoder) = @_; |
87
|
3
|
|
33
|
|
|
12
|
$encoder ||= Email::MIME::RFC2047::Encoder->new(); |
88
|
|
|
|
|
|
|
|
89
|
3
|
|
|
|
|
11
|
my $name = $self->{name}; |
90
|
3
|
50
|
33
|
|
|
27
|
die("empty group name") if !defined($name) || $name eq ''; |
91
|
|
|
|
|
|
|
|
92
|
3
|
|
|
|
|
17
|
my $result = $encoder->encode_phrase($name) . ': '; |
93
|
|
|
|
|
|
|
|
94
|
3
|
|
|
|
|
12
|
my $mailbox_list = $self->{mailbox_list}; |
95
|
3
|
50
|
|
|
|
35
|
$result .= $mailbox_list->format($encoder) if $mailbox_list; |
96
|
|
|
|
|
|
|
|
97
|
3
|
|
|
|
|
10
|
$result .= ';'; |
98
|
|
|
|
|
|
|
|
99
|
3
|
|
|
|
|
12
|
return $result; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |