| 1 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | package Mail::IMAPClient::BodyStructure; | ||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Mail::IMAPClient::BodyStructure::Parse; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | # BUG?: old code used name "HEAD" instead of "HEADER", change? | ||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | my $HEAD = "HEAD"; | |||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | # my has file scope, not limited to package! | ||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | my $parser = Mail::IMAPClient::BodyStructure::Parse->new | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | or die "Cannot parse rules: $@\n" | ||||||||||||||||||||||||||||||||||||||||||
| 13 | . "Try remaking Mail::IMAPClient::BodyStructure::Parse.\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 10 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 10 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 10 | my $bodystructure = shift; | |||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 10 | ▶ | my $self = $parser->start($bodystructure) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 10 | $self->{_prefix} = ""; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 10 | ▶ | $self->{_id} = exists $self->{bodystructure} ? $HEAD : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 10 | $self->{_top} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 10 | ▶ | bless $self, ref($class) || $class; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 91 | ▶ | sub _get_thingy { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_thingy: called CC=10 SCAR=35.5
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 91 | my $thingy = shift; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 91 | ▶ | my $object = shift || ( ref $thingy ? $thingy : undef ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
shift() || (ref $thingy ? $thingy : undef)
MC/DC0%0/2
shift() || (ref $thingy ? $thingy : undef)
shift()
(ref $thingy ? $thingy : undef)
Truth table33%1/3
A || B
A= shift()B= (ref $thingy ? $thingy : undef)
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 91 | ▶ | unless ( $object && ref $object ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$object and ref $object
MC/DC0%0/2
$object and ref $object
$object
ref $object
Truth table33%1/3
A and B
A= $objectB= ref $object
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | warn $@ = "No argument passed to $thingy method."; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 91 | ▶ | unless ( UNIVERSAL::isa( $object, 'HASH' ) && exists $object->{$thingy} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
UNIVERSAL::isa($object, "HASH") and exists $object->{$thingy}
MC/DC0%0/2
UNIVERSAL::isa($object, "HASH") and exists $object->{$thingy}
UNIVERSAL::isa($object, "HASH")
exists $object->{$thingy}
Truth table33%1/3
A and B
A= UNIVERSAL::isa($object, "HASH")B= exists $object->{$thingy}
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | my $a = $thingy =~ /^[aeiou]/i ? 'an' : 'a'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | my $has = ref $object eq 'HASH' ? join( ", ", keys %$object ) : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | warn $@ = | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | ref($object) | ||||||||||||||||||||||||||||||||||||||||||
| 43 | . " $object does not have $a $thingy. " | ||||||||||||||||||||||||||||||||||||||||||
| 44 | . ( $has ? "It has $has" : '' ); | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 91 | my $value = $object->{$thingy}; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 91 | $value =~ s/\\ ( [\\\(\)"\x0d\x0a] )/$1/gx; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 91 | $value =~ s/^"(.*)"$/$1/; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 91 | $value; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | foreach my $datum ( | |||||||||||||||||||||||||||||||||||||||||
| 57 | qw/ bodytype bodysubtype bodyparms bodydisp bodyid bodydesc bodyenc | ||||||||||||||||||||||||||||||||||||||||||
| 58 | bodysize bodylang envelopestruct textlines / | ||||||||||||||||||||||||||||||||||||||||||
| 59 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 60 | { | ||||||||||||||||||||||||||||||||||||||||||
| 61 | 11 | ▶ | *$datum = sub { _get_thingy( $datum, @_ ) }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 7 | ▶ | sub parts { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parts: called CC=9 SCAR=26.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | return wantarray ? @{ $self->{PartsList} } : $self->{PartsList} | |||||||||||||||||||||||||||||||||||||||||
| 68 | 7 | ▶ | if exists $self->{PartsList}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 7 | my @parts; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 7 | $self->{PartsList} = \@parts; | |||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | # BUG?: should this default to ($HEAD, TEXT) | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 7 | ▶ | unless ( exists $self->{bodystructure} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | $self->{PartsIndex}{1} = $self; | |||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | @parts = ( $HEAD, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | return wantarray ? @parts : \@parts; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 7 | foreach my $p ( $self->bodystructure ) { | |||||||||||||||||||||||||||||||||||||||||
| 81 | 87 | my $id = $p->id; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 87 | push @parts, $id; | |||||||||||||||||||||||||||||||||||||||||
| 83 | 87 | $self->{PartsIndex}{$id} = $p; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 87 | ▶ | my $type = uc $p->bodytype || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
uc $p->bodytype || ''
MC/DC0%0/1
uc $p->bodytype || ''
uc $p->bodytype
Truth table50%1/2
A
A= uc $p->bodytype
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 87 | ▶ | push @parts, "$id.$HEAD" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | if $type eq 'MESSAGE'; | ||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 7 | ▶ | wantarray ? @parts : \@parts; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 58 | ▶ | sub bodystructure { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bodystructure: called CC=16 SCAR=28.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | 58 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 58 | my $partno = 0; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 58 | my @parts; | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 58 | ▶ | if ( $self->{_top} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 7 | ▶ | $self->{_id} ||= $HEAD; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"_id"} ||= $HEAD
MC/DC0%0/2
$self->{"_id"} ||= $HEAD
$self->{"_id"}
$HEAD
Truth table33%1/3
A ||= B
A= $self->{"_id"}B= $HEAD
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 7 | ▶ | $self->{_prefix} ||= $HEAD; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"_prefix"} ||= $HEAD
MC/DC0%0/2
$self->{"_prefix"} ||= $HEAD
$self->{"_prefix"}
$HEAD
Truth table33%1/3
A ||= B
A= $self->{"_prefix"}B= $HEAD
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 7 | $partno = 0; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 7 | foreach my $b ( @{ $self->{bodystructure} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 103 | 26 | $b->{_id} = ++$partno; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 26 | $b->{_prefix} = $partno; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 26 | push @parts, $b, $b->bodystructure; | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 7 | ▶ | return wantarray ? @parts : \@parts; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 51 | ▶ | my $prefix = $self->{_prefix} || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'_prefix'} || ''
MC/DC0%0/1
$self->{'_prefix'} || ''
$self->{'_prefix'}
Truth table50%1/2
A
A= $self->{'_prefix'}
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 51 | $prefix =~ s/\.?$/./; | |||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 51 | foreach my $p ( @{ $self->{bodystructure} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 114 | 61 | $partno++; | |||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | # BUG?: old code didn't add .TEXT sections, should we skip these? | ||||||||||||||||||||||||||||||||||||||||||
| 117 | # - This code needs to be generalised (maybe it belongs in parts()?) | ||||||||||||||||||||||||||||||||||||||||||
| 118 | # - Should every message should have HEAD (actually MIME) and TEXT? | ||||||||||||||||||||||||||||||||||||||||||
| 119 | # at least dovecot and iplanet appear to allow this even for | ||||||||||||||||||||||||||||||||||||||||||
| 120 | # non-multipart sections | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 61 | my $pno = $partno; | |||||||||||||||||||||||||||||||||||||||||
| 122 | 61 | ▶ | my $stype = $self->{bodytype} || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'bodytype'} || ''
MC/DC0%0/1
$self->{'bodytype'} || ''
$self->{'bodytype'}
Truth table50%1/2
A
A= $self->{'bodytype'}
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 61 | ▶ | my $ptype = $p->{bodytype} || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$p->{'bodytype'} || ''
MC/DC0%0/1
$p->{'bodytype'} || ''
$p->{'bodytype'}
Truth table50%1/2
A
A= $p->{'bodytype'}
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | # a message and the multipart inside of it "collapse together" | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 61 | ▶ | if ( $partno == 1 and $stype eq 'MESSAGE' and $ptype eq 'MULTIPART' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$partno == 1 and $stype eq "MESSAGE" and $ptype eq "MULTIPART"
$partno == 1 and $stype eq "MESSAGE"
MC/DC100%3/3
$partno == 1 and $stype eq "MESSAGE" and $ptype eq "MULTIPART"
$partno == 1
$stype eq "MESSAGE"
$ptype eq "MULTIPART"
Truth table100%4/4
A and B and C
A= $partno == 1B= $stype eq "MESSAGE"C= $ptype eq "MULTIPART"
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 15 | $pno = "TEXT"; | |||||||||||||||||||||||||||||||||||||||||
| 128 | 15 | $p->{_prefix} = "$prefix"; | |||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 46 | $p->{_prefix} = "$prefix$partno"; | |||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 61 | ▶ | $p->{_id} ||= "$prefix$pno"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$p->{"_id"} ||= "$prefix$pno"
MC/DC0%0/2
$p->{"_id"} ||= "$prefix$pno"
$p->{"_id"}
"$prefix$pno"
Truth table33%1/3
A ||= B
A= $p->{"_id"}B= "$prefix$pno"
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 61 | ▶ | push @parts, $p, $p->{bodystructure} ? $p->bodystructure : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 51 | ▶ | wantarray ? @parts : \@parts; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 87 | ▶ | sub id { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
id: called CC=6 SCAR=33.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 87 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 143 | return $self->{_id} | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 87 | ▶ | if exists $self->{_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | return $HEAD | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | if $self->{_top}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | # BUG?: can this be removed? ... seems wrong | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | if ( $self->{bodytype} eq 'MULTIPART' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | my $p = $self->{_id} || $self->{_prefix}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'_id'} || $self->{'_prefix'}
MC/DC0%0/2
$self->{'_id'} || $self->{'_prefix'}
$self->{'_id'}
$self->{'_prefix'}
Truth table0%0/3
A || B
A= $self->{'_id'}B= $self->{'_prefix'}
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $p =~ s/\.$//; | |||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | return $p; | |||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | return $self->{_id} ||= 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"_id"} ||= 1
MC/DC0%0/1
$self->{"_id"} ||= 1
$self->{"_id"}
Truth table0%0/2
A
A= $self->{"_id"}
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | package Mail::IMAPClient::BodyStructure::Part; | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 1 | our @ISA = qw/Mail::IMAPClient::BodyStructure/; | |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | package Mail::IMAPClient::BodyStructure::Envelope; | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 1 | our @ISA = qw/Mail::IMAPClient::BodyStructure/; | |||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 1 | my ( $class, $envelope ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | $parser->envelope($envelope); | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | 3 | ▶ | sub parse_string { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_string: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 3 | my ( $class, $envelope ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 3 | ▶ | $envelope = "(" . $envelope . ")" unless ( $envelope =~ /^\(/ ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 3 | $parser->envelopestruct($envelope); | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | sub from_addresses { shift->_addresses( from => 1 ) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from_addresses: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | sub sender_addresses { shift->_addresses( sender => 1 ) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sender_addresses: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | sub replyto_addresses { shift->_addresses( replyto => 1 ) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replyto_addresses: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 4 | ▶ | sub to_addresses { shift->_addresses( to => 0 ) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_addresses: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | sub cc_addresses { shift->_addresses( cc => 0 ) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cc_addresses: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | sub bcc_addresses { shift->_addresses( bcc => 0 ) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bcc_addresses: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 4 | ▶ | sub _addresses($$$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_addresses: called CC=7 SCAR=20.0
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 4 | my ( $self, $name, $isSender ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 186 | 4 | ▶ | ref $self->{$name} eq 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | or return (); | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 4 | my @list; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 4 | foreach ( @{ $self->{$name} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 191 | 4 | my $pn = $_->personalname; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 4 | ▶ | my $name = $pn && $pn ne 'NIL' ? "$pn " : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$pn and $pn ne "NIL"
MC/DC50%1/2
$pn and $pn ne "NIL"
$pn
$pn ne "NIL"
Truth table66%2/3
A and B
A= $pnB= $pn ne "NIL"
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 4 | push @list, $name . '<' . $_->mailboxname . '@' . $_->hostname . '>'; | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | wantarray ? @list | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 4 | ▶ | : $isSender ? $list[0] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | : \@list; | ||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | 1 | for my $datum ( | |||||||||||||||||||||||||||||||||||||||||
| 204 | qw(subject inreplyto from messageid bcc date | ||||||||||||||||||||||||||||||||||||||||||
| 205 | replyto to sender cc) | ||||||||||||||||||||||||||||||||||||||||||
| 206 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 207 | { | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 24 | ▶ | *$datum = sub { @_ > 1 ? $_[0]->{$datum} = $_[1] : $_[0]->{$datum} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 10 | } | |||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | package Mail::IMAPClient::BodyStructure::Address; | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 1 | our @ISA = qw/Mail::IMAPClient::BodyStructure/; | |||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | 1 | for my $datum (qw(personalname mailboxname hostname sourcename)) { | |||||||||||||||||||||||||||||||||||||||||
| 216 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 12 | ▶ | *$datum = sub { shift->{$datum}; }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | __END__ | ||||||||||||||||||||||||||||||||||||||||||