| 1 | package Net::IMAP::Client::MsgSummary; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use Encode (); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use Net::IMAP::Client::MsgAddress (); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 0 | my ($class, $data, $part_id, $has_headers) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 0 | bless my $self = {}, $class; | |||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | ▶ | if ($part_id) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | $self->{part_id} = $part_id; | |||||||||||||||||||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | my $tmp = $data->{BODY}; | |||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | if ($tmp) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | $self->_parse_body($tmp); | |||||||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | $tmp = $data->{BODYSTRUCTURE}; | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | if ($tmp) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | $self->_parse_bodystructure($tmp); | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | $tmp = $data->{ENVELOPE}; | |||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if ($tmp) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | $self->_parse_envelope($tmp); | |||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | $self->{flags} = $data->{FLAGS}; | |||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | $self->{internaldate} = $data->{INTERNALDATE}; | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | $self->{rfc822_size} = $data->{'RFC822.SIZE'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | $self->{uid} = $data->{UID}; | |||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if ($has_headers) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | while (my ($key, $val) = each %$data) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | if ($key =~ /^body(?:\.peek)?\s*\[\s*header\.fields/i) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | $self->{headers} = $val; | |||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub _decode { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_decode: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my ($str) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if (defined($str)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | eval { $str = Encode::decode('MIME-Header', $str); }; | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | return $str; | |||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub type { $_[0]->{type} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | sub subtype { $_[0]->{subtype} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subtype: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub parameters { $_[0]->{parameters} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parameters: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | sub cid { $_[0]->{cid} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cid: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub description { _decode($_[0]->{description}) } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | sub transfer_encoding { $_[0]->{transfer_encoding} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
transfer_encoding: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | sub encoded_size { $_[0]->{encoded_size} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
encoded_size: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub content_type { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
content_type: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | if ($self->type) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | return $self->type . '/' . $self->subtype; | |||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | if ($self->multipart) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | return 'multipart/' . $self->multipart; | |||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | sub charset { $_[0]->{parameters}->{charset} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
charset: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub filename { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
filename: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my $disp = $self->{disposition}; | |||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my $filename; | |||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | if ($disp) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | while (my ($key, $val) = each %$disp) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | if (ref($val) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $filename = $val->{filename}; | |||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | last if $filename; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | unless ($filename) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | $filename = $_[0]->{parameters}->{name}; | |||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | return _decode($filename); | |||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | sub name { _decode($_[0]->{parameters}->{name}) } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | sub multipart { $_[0]->{multipart_type} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
multipart: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | sub parts { $_[0]->{parts} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parts: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | sub rfc822_size { $_[0]->{rfc822_size} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rfc822_size: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | sub internaldate { $_[0]->{internaldate} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
internaldate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | sub flags { $_[0]->{flags} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flags: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | sub uid { $_[0]->{uid} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uid: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | sub part_id { $_[0]->{part_id } } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
part_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | sub md5 { $_[0]->{md5} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
md5: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | sub disposition { $_[0]->{disposition} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disposition: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub language { $_[0]->{language} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
language: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # envelope | ||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub date { $_[0]->{date} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
date: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sub subject { _decode($_[0]->{subject}) } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subject: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | sub from { $_[0]->{from} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub sender { $_[0]->{sender} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sender: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | sub reply_to { $_[0]->{reply_to} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reply_to: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | sub to { $_[0]->{to} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | sub cc { $_[0]->{cc} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cc: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | sub bcc { $_[0]->{bcc} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bcc: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | sub in_reply_to { $_[0]->{in_reply_to} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
in_reply_to: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub message_id { $_[0]->{message_id} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
message_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | sub seq_id { $_[0]->{seq_id} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
seq_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | sub headers { $_[0]->{headers} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
headers: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # utils | ||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub get_subpart { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_subpart: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my ($self, $part) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | foreach my $index (split(/\./, $part)) { | |||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $self = $self->parts->[$index - 1]; | |||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 2 | my %MT_HAS_ATTACHMENT = ( mixed => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | sub has_attachments { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_attachments: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my $mt = $self->multipart; | |||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | return $mt && $MT_HAS_ATTACHMENT{$mt} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$mt and $MT_HAS_ATTACHMENT{$mt}
MC/DC0%0/2
$mt and $MT_HAS_ATTACHMENT{$mt}
$mt
$MT_HAS_ATTACHMENT{$mt}
Truth table0%0/3
A and B
A= $mtB= $MT_HAS_ATTACHMENT{$mt}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | sub is_message { $_[0]->content_type eq 'message/rfc822' } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_message: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | sub message { $_[0]->{message} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
message: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | sub _parse_body { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_body: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | my ($self, $struct) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | if (ref($struct->[0]) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my @tmp = @$struct; | |||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $multipart = pop @tmp; | |||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | my $part_id = $self->{part_id} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'part_id'} || ''
MC/DC0%0/1
$self->{'part_id'} || ''
$self->{'part_id'}
Truth table0%0/2
A
A= $self->{'part_id'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | $part_id .= '.' | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 178 | if $part_id; | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | @tmp = map { __PACKAGE__->new({ BODY => $_}, $part_id . ++$i) } @tmp; | |||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $self->{multipart_type} = lc $multipart; | |||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $self->{parts} = \@tmp; | |||||||||||||||||||||||||||||||||||||||||||||
| 183 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $self->{type} = lc $struct->[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $self->{subtype} = lc $struct->[1]; | |||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | if ($struct->[2]) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my %tmp = @{$struct->[2]}; | |||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $self->{parameters} = \%tmp; | |||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | $self->{cid} = $struct->[3]; | |||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $self->{description} = $struct->[4]; | |||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $self->{transfer_encoding} = $struct->[5]; | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $self->{encoded_size} = $struct->[6]; | |||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | if ($self->is_message && $struct->[7] && $struct->[8]) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->is_message and $struct->[7] and $struct->[8]
$self->is_message and $struct->[7]
MC/DC0%0/3
$self->is_message and $struct->[7] and $struct->[8]
$self->is_message
$struct->[7]
$struct->[8]
Truth table0%0/4
A and B and C
A= $self->is_messageB= $struct->[7]C= $struct->[8]
| |||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # continue parsing attached message | ||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $self->{message} = __PACKAGE__->new({ | |||||||||||||||||||||||||||||||||||||||||||||
| 198 | ENVELOPE => $struct->[7], | ||||||||||||||||||||||||||||||||||||||||||||||
| 199 | BODY => $struct->[8], | ||||||||||||||||||||||||||||||||||||||||||||||
| 200 | }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | sub _parse_bodystructure { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_bodystructure: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | my ($self, $struct) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | if (ref($struct->[0]) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | my $multipart; | |||||||||||||||||||||||||||||||||||||||||||||
| 210 | my @tmp; | ||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | foreach (@$struct) { | |||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | if (ref($_) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | push @tmp, $_; | |||||||||||||||||||||||||||||||||||||||||||||
| 214 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | $multipart = $_; | |||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | last; # XXX: ignoring the rest (extension data) for now. | |||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | my $part_id = $self->{part_id} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'part_id'} || ''
MC/DC0%0/1
$self->{'part_id'} || ''
$self->{'part_id'}
Truth table0%0/2
A
A= $self->{'part_id'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | $part_id .= '.' | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 221 | if $part_id; | ||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | @tmp = map { __PACKAGE__->new({ BODYSTRUCTURE => $_}, $part_id . ++$i) } @tmp; | |||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | $self->{multipart_type} = lc $multipart; | |||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $self->{parts} = \@tmp; | |||||||||||||||||||||||||||||||||||||||||||||
| 226 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $self->{type} = lc $struct->[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | $self->{subtype} = lc $struct->[1]; | |||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my $a = $struct->[2]; | |||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | if ($a) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | __lc_key_in_array($a); | |||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | my %tmp = @$a; | |||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | $self->{parameters} = \%tmp; | |||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $self->{cid} = $struct->[3]; | |||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $self->{description} = $struct->[4]; | |||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $self->{transfer_encoding} = $struct->[5]; | |||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | $self->{encoded_size} = $struct->[6]; | |||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if ($self->is_message && $struct->[7] && $struct->[8]) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
$self->is_message and $struct->[7] and $struct->[8]
$self->is_message and $struct->[7]
MC/DC0%0/3
$self->is_message and $struct->[7] and $struct->[8]
$self->is_message
$struct->[7]
$struct->[8]
Truth table0%0/4
A and B and C
A= $self->is_messageB= $struct->[7]C= $struct->[8]
| |||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # continue parsing attached message | ||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $self->{message} = __PACKAGE__->new({ | |||||||||||||||||||||||||||||||||||||||||||||
| 243 | ENVELOPE => $struct->[7], | ||||||||||||||||||||||||||||||||||||||||||||||
| 244 | BODYSTRUCTURE => $struct->[8], | ||||||||||||||||||||||||||||||||||||||||||||||
| 245 | }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } elsif ($self->type ne 'text') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | $self->{md5} = $struct->[7]; | |||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my $a = $struct->[8]; | |||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | if ($a) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | for (my $i = 0; $i < @$a; ++$i) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $a->[$i] = lc $a->[$i]; | |||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ++$i; | |||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | if (ref($a->[$i]) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | __lc_key_in_array($a->[$i]); | |||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | my %foo = @{ $a->[$i] }; | |||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $a->[$i] = \%foo; | |||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my %tmp = @$a; | |||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $self->{disposition} = \%tmp; | |||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | $self->{language} = $struct->[9]; | |||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | sub __lc_key_in_array { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__lc_key_in_array: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | my ($a) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | for (my $i = 0; $i < @$a; $i += 2) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | $a->[$i] = lc $a->[$i]; | |||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | sub _parse_envelope { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_envelope: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | my ($self, $struct) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | $self->{date} = $struct->[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | $self->{subject} = $struct->[1]; | |||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | $self->{from} = _parse_address($struct->[2]); | |||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | $self->{sender} = _parse_address($struct->[3]); | |||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | $self->{reply_to} = _parse_address($struct->[4]); | |||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | $self->{to} = _parse_address($struct->[5]); | |||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | $self->{cc} = _parse_address($struct->[6]); | |||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | $self->{bcc} = _parse_address($struct->[7]); | |||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | $self->{in_reply_to} = $struct->[8]; | |||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | $self->{message_id} = $struct->[9]; | |||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | sub _parse_address { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_address: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my ($adr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | if ($adr) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | $adr = [ map { Net::IMAP::Client::MsgAddress->new($_) } @$adr ]; | |||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | return $adr; | |||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||
| 298 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||