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