| 1 | package Email::MIME::RFC2047::AddressList; | ||||||||||||||||||||||||||||
| 2 | 4 | $Email::MIME::RFC2047::AddressList::VERSION = '0.96'; | |||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | # ABSTRACT: Handling of MIME encoded address lists | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use base qw(Email::MIME::RFC2047::Parser); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Email::MIME::RFC2047::Decoder; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 4 | ▶ | use Email::MIME::RFC2047::Address; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | sub new { | ||||||||||||||||||||||||||||
| 14 | 22 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 22 | my $self = [ @_ ]; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 22 | return bless($self, $class); | |||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | sub parse { | ||||||||||||||||||||||||||||
| 22 | 20 | ▶ | my ($class, $string, $decoder) = @_; | ||||||||||||||||||||||||||
|
Subroutine
parse: called CC=6 SCAR=18.3
Pod
documented
| |||||||||||||||||||||||||||||
| 23 | 20 | ▶ | my $string_ref = ref($string) ? $string : \$string; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | 20 | ▶ | $decoder ||= Email::MIME::RFC2047::Decoder->new(); | ||||||||||||||||||||||||||
|
Condition66%2/3
$decoder ||= "Email::MIME::RFC2047::Decoder"->new
MC/DC0%0/2
$decoder ||= "Email::MIME::RFC2047::Decoder"->new
$decoder
"Email::MIME::RFC2047::Decoder"->new
Truth table66%2/3
A ||= B
A= $decoderB= "Email::MIME::RFC2047::Decoder"->new
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 20 | my @addresses; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 20 | ▶ | do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 40 | my $address = $class->_parse_item($string_ref, $decoder); | |||||||||||||||||||||||||||
| 30 | 33 | push(@addresses, $address); | |||||||||||||||||||||||||||
| 31 | } while ($$string_ref =~ /\G,/cg); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 13 | ▶ | if (!ref($string) && pos($string) < length($string)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not ref $string and pos $string < length $string
MC/DC0%0/2
not ref $string and pos $string < length $string
not ref $string
pos $string < length $string
Truth table66%2/3
not(A) and B
A= not ref $stringB= pos $string < length $string
| |||||||||||||||||||||||||||||
| 34 | 0 | return $class->_parse_error($string_ref); | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 13 | return $class->new(@addresses); | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | sub _parse_item { | ||||||||||||||||||||||||||||
| 41 | 19 | ▶ | my ($class, $string_ref, $decoder) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_parse_item: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 19 | return Email::MIME::RFC2047::Address->parse( | |||||||||||||||||||||||||||
| 44 | $string_ref, $decoder | ||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | sub items { | ||||||||||||||||||||||||||||
| 49 | 5 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
items: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 5 | return @$self; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | sub push { | ||||||||||||||||||||||||||||
| 55 | 13 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
push: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 13 | push(@$self, @_); | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 13 | return; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | sub format { | ||||||||||||||||||||||||||||
| 63 | 7 | ▶ | my ($self, $encoder) = @_; | ||||||||||||||||||||||||||
|
Subroutine
format: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||
| 64 | 7 | ▶ | $encoder ||= Email::MIME::RFC2047::Encoder->new(); | ||||||||||||||||||||||||||
|
Condition33%1/3
$encoder ||= "Email::MIME::RFC2047::Encoder"->new
MC/DC0%0/2
$encoder ||= "Email::MIME::RFC2047::Encoder"->new
$encoder
"Email::MIME::RFC2047::Encoder"->new
Truth table33%1/3
A ||= B
A= $encoderB= "Email::MIME::RFC2047::Encoder"->new
| |||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 7 | return join(', ', map { $_->format($encoder) } @$self); | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 4 | 1; | |||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | __END__ | ||||||||||||||||||||||||||||