| 1 | package Net::IMAP::Client::MsgAddress; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use Encode (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 6 | 0 | my ($class, $struct) = @_; | |||||||||
| 7 | 0 | my $self = { | |||||||||
| 8 | name => $struct->[0], | ||||||||||
| 9 | at_domain_list => $struct->[1], | ||||||||||
| 10 | mailbox => $struct->[2], | ||||||||||
| 11 | host => $struct->[3], | ||||||||||
| 12 | }; | ||||||||||
| 13 | 0 | bless $self, $class; | |||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | 0 | ▶ | sub _decode { | ||||||||
|
Subroutine
_decode: not called CC=2 SCAR=17.9
| |||||||||||
| 17 | 0 | my ($str) = @_; | |||||||||
| 18 | 0 | ▶ | if (defined($str)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 0 | eval { $str = Encode::decode('MIME-Header', $str); }; | |||||||||
| 20 | } | ||||||||||
| 21 | 0 | return $str; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 2 | ▶ | use overload q("") => \&as_string; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub name { _decode($_[0]->{name}) } | ||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 27 | 0 | ▶ | sub at_domain_list { _decode($_[0]->{at_domain_list}) } | ||||||||
|
Subroutine
at_domain_list: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 28 | 0 | ▶ | sub mailbox { _decode($_[0]->{mailbox}) } | ||||||||
|
Subroutine
mailbox: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 29 | 0 | ▶ | sub host { _decode($_[0]->{host}) } | ||||||||
|
Subroutine
host: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 30 | |||||||||||
| 31 | 0 | ▶ | sub email { | ||||||||
|
Subroutine
email: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 32 | 0 | my ($self) = @_; | |||||||||
| 33 | 0 | return $self->mailbox . '@' . $self->host; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | sub as_string { | ||||||||
|
Subroutine
as_string: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 37 | 0 | my ($self) = @_; | |||||||||
| 38 | 0 | my $str; | |||||||||
| 39 | 0 | ▶ | if (($str = $self->name)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 0 | $str .= ' <' . $self->email . '>'; | |||||||||
| 41 | } else { | ||||||||||
| 42 | 0 | $str = $self->email; | |||||||||
| 43 | } | ||||||||||
| 44 | 0 | return $str; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 2 | 1; | |||||||||
| 48 | |||||||||||
| 49 | __END__ | ||||||||||