| 1 | # Copyrights 2001-2023 by [Mark Overmeer]. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # For other contributors see ChangeLog. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # See the manual pages for details on the licensing terms. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # Pod stripped from pm file by OODoc 2.03. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # This code is part of distribution Mail-Box-IMAP4. Meta-POD processed with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # OODoc into POD and HTML manual-pages. See README.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Copyright Mark Overmeer. Licensed under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | package Mail::Server::IMAP4::Fetch; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | $VERSION = '3.008'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use Date::Parse; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use Digest::MD5 qw/md5_base64/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | sub new($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 7 | ▶ | { my ($class, $part, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=21 SCAR=30.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 7 | my $head = $part->head; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 7 | my $body = $part->body; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 7 | my $type = $body->type->study; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 7 | my $self = bless | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | { type => $type->body | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | , typeattr => [ $type->attrPairs ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | , charset => $body->charset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | , bodylines => $body->nrLines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | , bodysize => $body->size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 7 | $self->{headbegin} = ($head->fileLocation)[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 7 | @{$self}{qw/bodybegin bodyend/} = $body->fileLocation; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # The fields use the defined() check, to avoid accidental expensive | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # stringification by the field objects. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 7 | my ($field, $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 7 | ▶ | $self->{date} = $field->unfoldedBody | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | if defined($field = $head->get('Date')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 7 | ▶ | $self->{subject} = $field->unfoldedBody | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | if defined($field = $head->get('Subject')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 7 | ▶ | $self->{description} = $field->unfoldedBody | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | if defined($field = $head->get('Content-Description')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 7 | ▶ | $self->{language} = $field->unfoldedBody | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | if defined($field = $head->get('Content-Language')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 7 | ▶ | $self->{filename} = $value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | if defined($value = $body->dispositionFilename); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | $self->{bodyMD5} = md5_base64($body->string) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 7 | ▶ | if $args{md5checksums}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 7 | ▶ | if(defined($field = $body->transferEncoding)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 7 | { my $tf = $field->unfoldedBody; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 7 | ▶ | $self->{transferenc} = $tf unless $tf eq 'none'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # Should become: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # $self->{disposition} = [ $field->body, $field->study->attributes ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 7 | ▶ | if(defined($field = $body->disposition)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 7 | { my $how = $field->body; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 7 | ▶ | $how = $body->isText ? 'inline' : 'attachment' if $how eq 'none'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 7 | $self->{disposition} = [ $how, $field->attributes ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | { $self->{disposition} = [ ($body->isText ? 'inline' : 'attachment') ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 7 | ▶ | my $id = $head->get('Content-Message-ID') || $head->get("Message-ID"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$head->get('Content-Message-ID') || $head->get('Message-ID')
MC/DC50%1/2
$head->get('Content-Message-ID') || $head->get('Message-ID')
$head->get('Content-Message-ID')
$head->get('Message-ID')
Truth table66%2/3
A || B
A= $head->get('Content-Message-ID')B= $head->get('Message-ID')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 7 | ▶ | if(defined $id) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 5 | { my $msgid = $id->unfoldedBody; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 5 | $msgid =~ s/^\<*/</; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 5 | $msgid =~ s/\>*$/>/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 5 | ▶ | $self->{messageid} = $msgid if length $msgid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 7 | foreach my $addr ( qw/to from sender reply-to cc bcc/ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 42 | ▶ | { my $addrs = $head->study($addr) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 12 | foreach my $group ($addrs->groups) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 11 | { my @addrs = map { [ $_->phrase, $_->username, $_->domain ] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | $group->addresses; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 11 | push @{$self->{$addr}}, [ $group->name, @addrs ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 7 | ▶ | if($body->isMultipart) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 1 | { $self->{parts} = [ map { $class->new($_) } $body->parts ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | elsif($body->isNested) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | { $self->{nest} = $class->new($body->nested); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 7 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | sub headLocation() { @{ (shift) }{ qw/headbegin bodybegin/ } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
headLocation: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | sub bodyLocation() { @{ (shift) }{ qw/bodybegin bodyend/ } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bodyLocation: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub partLocation() { @{ (shift) }{ qw/headbegin bodyend/ } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
partLocation: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | sub fetchBody($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 18 | ▶ | { my ($self, $extended) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetchBody: called CC=15 SCAR=29.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 18 | my $type = uc $self->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 18 | my ($mediatype, $subtype) = split m[/], $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 18 | ▶ | if($self->{parts}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | { # Multipart message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | # WARNING: no blanks between part descriptions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | my $parts = join '', map $_->fetchBody($extended), @{$self->{parts}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 2 | ▶ | my @fields = (\$parts, $subtype || 'MIXED'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$subtype || 'MIXED'
MC/DC0%0/1
$subtype || 'MIXED'
$subtype
Truth table50%1/2
A
A= $subtype
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 2 | ▶ | if($extended) # only included when any valid info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1 | { my @attr; # don't know what to include here | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | my @disp; # don't know about this either | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | push @fields, \@attr, \@disp, $self->{language} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 1 | ▶ | if @attr || @disp || defined $self->{language}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
@attr or @disp or defined $self->{"language"}
@attr or @disp
MC/DC0%0/3
@attr or @disp or defined $self->{"language"}
@attr
@disp
defined $self->{"language"}
Truth table25%1/4
A or B or C
A= @attrB= @dispC= defined $self->{"language"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 2 | return $self->_imapList(@fields); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | # Simple message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | my @fields = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | ( ($mediatype || 'TEXT') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | , ($subtype || 'PLAIN') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | , $self->{typeattr} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | , $self->{messageid} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | , $self->{description} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | , uc($self->{transferenc} || '8BIT') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | , \($self->{bodysize}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 16 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$mediatype || 'TEXT'
$subtype || 'PLAIN'
$self->{'transferenc'} || '8BIT'
MC/DC0%0/1
$mediatype || 'TEXT'
$mediatype
MC/DC0%0/1
$subtype || 'PLAIN'
$subtype
MC/DC100%1/1
$self->{'transferenc'} || '8BIT'
$self->{'transferenc'}
Truth table50%1/2
A
A= $mediatype
Truth table50%1/2
A
A= $subtype
Truth table100%2/2
A
A= $self->{'transferenc'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 16 | ▶ | if(my $nest = $self->{nest}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | { # type MESSAGE (message/rfc822 encapsulated) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | push @fields | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | , \$nest->fetchEnvelope, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | , \$nest->fetchBody($extended); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 16 | push @fields, \$self->{bodylines}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 8 | push @fields, @{$self}{ qw/bodyMD5 disposition language/ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | if $extended | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 16 | ▶ | && ($self->{bodyMD5} || $self->{disposition} || $self->{language}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
$extended and $self->{"bodyMD5"} || $self->{"disposition"} || $self->{"language"}
$self->{"bodyMD5"} or $self->{"disposition"} or $self->{"language"}
$self->{"bodyMD5"} or $self->{"disposition"}
MC/DC0%0/4
$extended and $self->{"bodyMD5"} || $self->{"disposition"} || $self->{"language"}
$extended
$self->{"bodyMD5"}
$self->{"disposition"}
$self->{"language"}
Truth table20%1/5
A and B or C or D
A= $extendedB= $self->{"bodyMD5"}C= $self->{"disposition"}D= $self->{"language"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 16 | $self->_imapList(@fields); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | sub fetchEnvelope() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 8 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetchEnvelope: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 8 | my @fields = ($self->{date}, $self->{subject}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 8 | foreach my $addr ( qw/from sender reply-to to cc bcc/ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 48 | ▶ | { unless($self->{$addr}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 33 | { push @fields, undef; # NIL | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 33 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | # For now, group information is ignored... RFC2060 is very | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | # unclear about it... and seems incompatible with RFC2822 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 15 | my $addresses = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 15 | foreach my $group (@{$self->{$addr}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 15 | { my ($name, @addr) = @$group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | # addr_adl is obsoleted by rfc2822 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | $addresses .= $self->_imapList($_->[0], undef, $_->[1], $_->[2]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 15 | foreach @addr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 15 | push @fields, \$addresses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 8 | push @fields, $self->{'in-reply-to'}, $self->{messageid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 8 | $self->_imapList(@fields); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | sub fetchSize() { shift->{bodysize} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetchSize: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | sub part(;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 9 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
part: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 9 | ▶ | my $nr = shift or return $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 7 | my @nrs = split /\./, $nr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 7 | ▶ | while(@nrs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 8 | { my $take = shift @nrs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 8 | ▶ | if(exists $self->{nest} && $take==1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
exists $self->{"nest"} and $take == 1
MC/DC50%1/2
exists $self->{"nest"} and $take == 1
exists $self->{"nest"}
$take == 1
Truth table66%2/3
A and B
A= exists $self->{"nest"}B= $take == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 1 | { $self = $self->{nest} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 5 | ▶ | elsif(exists $self->{parts} && @{$self->{parts}} >= $take) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
exists $self->{"parts"} and @{$self->{"parts"};} >= $take
MC/DC100%2/2
exists $self->{"parts"} and @{$self->{"parts"};} >= $take
exists $self->{"parts"}
@{$self->{"parts"};} >= $take
Truth table100%3/3
A and B
A= exists $self->{"parts"}B= @{$self->{"parts"};} >= $take
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 4 | { $self = $self->{parts}[$take-1] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 3 | else { return undef } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 4 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | sub printStructure(;$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
printStructure: not called CC=16 SCAR=56.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | my $fh = @_ ? shift : select; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | my $number = @_ ? shift : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $buffer; # only filled if filehandle==undef | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | open $fh, '>:raw', \$buffer unless defined $fh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my $type = $self->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | my $subject = $self->{subject} || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'subject'} || ''
MC/DC0%0/1
$self->{'subject'} || ''
$self->{'subject'}
Truth table0%0/2
A
A= $self->{'subject'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my $text = "$number $type: $subject\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | my $hbegin = $self->{headbegin} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'headbegin'} || 0
MC/DC0%0/1
$self->{'headbegin'} || 0
$self->{'headbegin'}
Truth table0%0/2
A
A= $self->{'headbegin'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | my $bbegin = $self->{bodybegin} || '?'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'bodybegin'} || '?'
MC/DC0%0/1
$self->{'bodybegin'} || '?'
$self->{'bodybegin'}
Truth table0%0/2
A
A= $self->{'bodybegin'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | my $bodyend = $self->{bodyend} || '?'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'bodyend'} || '?'
MC/DC0%0/1
$self->{'bodyend'} || '?'
$self->{'bodyend'}
Truth table0%0/2
A
A= $self->{'bodyend'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | my $size = defined $self->{bodysize} ? $self->{bodysize} : '?'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | my $lines = defined $self->{bodylines} ? $self->{bodylines} : '?'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $text .= ' ' x (length($number) + 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $text .= "@ $hbegin-$bbegin-$bodyend, $size bytes, $lines lines\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | ref $fh eq 'GLOB' ? (print $fh $text) : $fh->print($text); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | if($self->{nest}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | { $self->{nest}->printStructure($fh, length($number) ? $number.'.1' :'1'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | elsif($self->{parts}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | { my $count = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | $number .= '.' if length $number; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | $_->printStructure($fh, $number.$count++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | foreach @{$self->{parts}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $buffer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | # Concatenate the elements of a list, as the IMAP protocol does. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | # ARRAYS are included a sublist, and normal strings get quoted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | # Pass a ref-scalar if something needs to be included without | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | # quoting. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | sub _imapList(@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 65 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_imapList: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 65 | my @f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 65 | foreach (@_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 328 | ▶ | { if(ref $_ eq 'ARRAY') { push @f, $self->_imapList(@$_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 53 | elsif(ref $_ eq 'SCALAR') { push @f, ${$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 100 | elsif(!defined $_) { push @f, 'NIL' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 151 | { my $copy = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 151 | $copy =~ s/\\/\\\\/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 151 | $copy =~ s/\"/\\"/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 151 | push @f, qq#"$_"#; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 65 | local $" = ' '; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 65 | "(@f)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||