line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Email::MIME::RFC2047::Group; |
2
|
|
|
|
|
|
|
$Email::MIME::RFC2047::Group::VERSION = '0.95'; |
3
|
4
|
|
|
4
|
|
16
|
use strict; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
106
|
|
4
|
4
|
|
|
4
|
|
15
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
108
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Handling of MIME encoded mailbox groups |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
15
|
use base qw(Email::MIME::RFC2047::Address); |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
307
|
|
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
18
|
use Email::MIME::RFC2047::Decoder; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
199
|
|
11
|
4
|
|
|
4
|
|
1356
|
use Email::MIME::RFC2047::MailboxList; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
973
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
9
|
|
|
9
|
1
|
24
|
my $class = shift; |
15
|
|
|
|
|
|
|
|
16
|
9
|
|
|
|
|
10
|
my $self; |
17
|
|
|
|
|
|
|
|
18
|
9
|
100
|
|
|
|
17
|
if (@_ >= 2) { |
19
|
7
|
|
|
|
|
18
|
$self = { @_ }; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
else { |
22
|
2
|
|
|
|
|
2
|
$self = $_[0]; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
9
|
|
|
|
|
21
|
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
|
7
|
my $self = shift; |
69
|
|
|
|
|
|
|
|
70
|
2
|
|
|
|
|
4
|
my $old_name = $self->{name}; |
71
|
2
|
50
|
|
|
|
5
|
$self->{name} = $_[0] if @_; |
72
|
|
|
|
|
|
|
|
73
|
2
|
|
|
|
|
8
|
return $old_name; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub mailbox_list { |
77
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
78
|
|
|
|
|
|
|
|
79
|
2
|
|
|
|
|
3
|
my $old_mailbox_list = $self->{mailbox_list}; |
80
|
2
|
50
|
|
|
|
7
|
$self->{mailbox_list} = $_[0] if @_; |
81
|
|
|
|
|
|
|
|
82
|
2
|
|
|
|
|
10
|
return $old_mailbox_list; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub format { |
86
|
3
|
|
|
3
|
1
|
8
|
my ($self, $encoder) = @_; |
87
|
3
|
|
33
|
|
|
10
|
$encoder ||= Email::MIME::RFC2047::Encoder->new(); |
88
|
|
|
|
|
|
|
|
89
|
3
|
|
|
|
|
5
|
my $name = $self->{name}; |
90
|
3
|
50
|
33
|
|
|
17
|
die("empty group name") if !defined($name) || $name eq ''; |
91
|
|
|
|
|
|
|
|
92
|
3
|
|
|
|
|
9
|
my $result = $encoder->encode_phrase($name) . ': '; |
93
|
|
|
|
|
|
|
|
94
|
3
|
|
|
|
|
6
|
my $mailbox_list = $self->{mailbox_list}; |
95
|
3
|
50
|
|
|
|
17
|
$result .= $mailbox_list->format($encoder) if $mailbox_list; |
96
|
|
|
|
|
|
|
|
97
|
3
|
|
|
|
|
6
|
$result .= ';'; |
98
|
|
|
|
|
|
|
|
99
|
3
|
|
|
|
|
8
|
return $result; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |