| 1 | # Copyrights 2001-2023 by [Mark Overmeer <markov@cpan.org>]. | ||||||||||||||||||||||||||||||||||||||||||
| 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-Message. 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::Message::Body; | ||||||||||||||||||||||||||||||||||||||||||
| 10 | 34 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 34 | $VERSION = '3.013'; | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 34 | ▶ | use base 'Mail::Reporter'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 34 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 34 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 34 | ▶ | use Mail::Message::Field; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 34 | ▶ | use Mail::Message::Body::Lines; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 34 | ▶ | use Mail::Message::Body::File; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 34 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 34 | ▶ | use Scalar::Util qw/weaken refaddr/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 34 | ▶ | use File::Basename qw/basename/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 34 | ▶ | use MIME::Types; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 34 | my $mime_types = MIME::Types->new; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 34 | my $mime_plain = $mime_types->type('text/plain'); | |||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | use overload | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 573 | ▶ | bool => sub {1} # $body->print if $body | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | , '""' => 'string_unless_carp' | ||||||||||||||||||||||||||||||||||||||||||
| 34 | , '@{}' => 'lines' | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 14 | ▶ | , '==' => sub {ref $_[1] && refaddr $_[0] == refaddr $_[1]} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 34 | ▶ | , '!=' => sub {ref $_[1] && refaddr $_[0] != refaddr $_[1]}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 34 | my $body_count = 0; # to be able to compare bodies for equivalence. | |||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | sub new(@) | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 262 | ▶ | { my $class = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 262 | ▶ | return $class->SUPER::new(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | unless $class eq __PACKAGE__; | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 19 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | exists $args{file} | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 19 | ▶ | ? Mail::Message::Body::File->new(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | : Mail::Message::Body::Lines->new(@_); | ||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | # All body implementations shall implement all of the following!! | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub _data_from_filename(@) {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_data_from_filename: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub _data_from_filehandle(@) {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_data_from_filehandle: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | sub _data_from_glob(@) {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_data_from_glob: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | sub _data_from_lines(@) {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_data_from_lines: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | sub init($) | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 243 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=45 SCAR=48.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 243 | $self->SUPER::init($args); | |||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 243 | ▶ | $self->{MMB_modified} = $args->{modified} || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'modified'} || 0
MC/DC0%0/1
$args->{'modified'} || 0
$args->{'modified'}
Truth table50%1/2
A
A= $args->{'modified'}
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 243 | my $filename = $args->{filename}; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 243 | my $mime = $args->{mime_type}; | |||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 243 | ▶ | if(defined(my $file = $args->{file})) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | { | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 3 | ▶ | if(!ref $file) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | { $self->_data_from_filename($file) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | $filename ||= $file; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$filename ||= $file
MC/DC0%0/2
$filename ||= $file
$filename
$file
Truth table0%0/3
A ||= B
A= $filenameB= $file
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | $mime ||= $mime_types->mimeTypeOf($filename) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$mime ||= $mime_types->mimeTypeOf($filename) || (-T $file ? "text/plain" : "application/octet-stream")
$mime_types->mimeTypeOf($filename) || (-T $file ? 'text/plain' : 'application/octet-stream')
MC/DC0%0/3
$mime ||= $mime_types->mimeTypeOf($filename) || (-T $file ? "text/plain" : "application/octet-stream")
$mime
$mime_types->mimeTypeOf($filename)
(-T $file ? 'text/plain' : 'application/octet-stream')
Truth table0%0/4
A ||= B || C
A= $mimeB= $mime_types->mimeTypeOf($filename)C= (-T $file ? 'text/plain' : 'application/octet-stream')
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | || (-T $file ? 'text/plain' : 'application/octet-stream'); | ||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | elsif(ref $file eq 'GLOB') | ||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | { $self->_data_from_glob($file) or return } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | elsif($file->isa('IO::Handle')) | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 3 | ▶ | { $self->_data_from_filehandle($file) or return } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | else | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | { croak "message body: illegal datatype `".ref($file)."' for file option" } | |||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | elsif(defined(my $data = $args->{data})) | ||||||||||||||||||||||||||||||||||||||||||
| 89 | { | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 154 | ▶ | if(!ref $data) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 88 | { my @lines = split /^/, $data; | |||||||||||||||||||||||||||||||||||||||||
| 92 | 88 | $self->_data_from_lines(\@lines) | |||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||
| 94 | elsif(ref $data eq 'ARRAY') | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 66 | ▶ | { $self->_data_from_lines($data) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | else | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | { croak "message body: illegal datatype `".ref($data)."' for data option" } | |||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | ▶ | elsif(! $self->isMultipart && ! $self->isNested) | |||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$self->isMultipart || $self->isNested
MC/DC100%2/2
$self->isMultipart || $self->isNested
$self->isMultipart
$self->isNested
Truth table100%3/3
A || B
A= $self->isMultipartB= $self->isNested
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | { # Neither 'file' nor 'data', so empty body. | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 32 | ▶ | $self->_data_from_lines( [] ) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | # Set the content info | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | my ($transfer, $disp, $descr, $cid) = @$args{ | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 243 | qw/transfer_encoding disposition description content_id/ }; | |||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 243 | ▶ | if(defined $filename) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | { $disp //= Mail::Message::Field->new | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$disp //= "Mail::Message::Field"->new("Content-Disposition", -T $filename ? "inline" : "attachment", "filename", basename($filename))
MC/DC0%0/2
$disp //= "Mail::Message::Field"->new("Content-Disposition", -T $filename ? "inline" : "attachment", "filename", basename($filename))
$disp
"Mail::Message::Field"->new("Content-Disposition", -T $filename ? "inline" : "attachment", "filename", basename($filename))
Truth table0%0/3
A //= B
A= $dispB= "Mail::Message::Field"->new("Content-Disposition", -T $filename ? "inline" : "attachment", "filename", basename($filename))
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | ( 'Content-Disposition' => (-T $filename ? 'inline' : 'attachment') | ||||||||||||||||||||||||||||||||||||||||||
| 113 | , filename => basename($filename) | ||||||||||||||||||||||||||||||||||||||||||
| 114 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | $mime //= $mime_types->mimeTypeOf($filename); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$mime //= $mime_types->mimeTypeOf($filename)
MC/DC0%0/2
$mime //= $mime_types->mimeTypeOf($filename)
$mime
$mime_types->mimeTypeOf($filename)
Truth table0%0/3
A //= B
A= $mimeB= $mime_types->mimeTypeOf($filename)
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 243 | ▶ | if(ref $mime && $mime->isa('MIME::Type')) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $mime and $mime->isa("MIME::Type")
MC/DC0%0/2
ref $mime and $mime->isa("MIME::Type")
ref $mime
$mime->isa("MIME::Type")
Truth table66%2/3
A and B
A= ref $mimeB= $mime->isa("MIME::Type")
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | { $mime = $mime->type; | |||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 243 | ▶ | if(defined(my $based = $args->{based_on})) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 133 | ▶ | { $mime //= $based->type; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$mime //= $based->type
MC/DC0%0/2
$mime //= $based->type
$mime
$based->type
Truth table66%2/3
A //= B
A= $mimeB= $based->type
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 133 | ▶ | $transfer //= $based->transferEncoding; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$transfer //= $based->transferEncoding
MC/DC0%0/2
$transfer //= $based->transferEncoding
$transfer
$based->transferEncoding
Truth table66%2/3
A //= B
A= $transferB= $based->transferEncoding
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 133 | ▶ | $disp //= $based->disposition; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$disp //= $based->disposition
MC/DC0%0/2
$disp //= $based->disposition
$disp
$based->disposition
Truth table33%1/3
A //= B
A= $dispB= $based->disposition
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | 133 | ▶ | $descr //= $based->description; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$descr //= $based->description
MC/DC0%0/2
$descr //= $based->description
$descr
$based->description
Truth table33%1/3
A //= B
A= $descrB= $based->description
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 133 | ▶ | $cid //= $based->contentId; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$cid //= $based->contentId
MC/DC0%0/2
$cid //= $based->contentId
$cid
$based->contentId
Truth table33%1/3
A //= B
A= $cidB= $based->contentId
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | $self->{MMB_checked} | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 133 | ▶ | = defined $args->{checked} ? $args->{checked} : $based->checked; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | else | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 110 | { $transfer = $args->{transfer_encoding}; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 110 | ▶ | $self->{MMB_checked} = $args->{checked} || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'checked'} || 0
MC/DC100%1/1
$args->{'checked'} || 0
$args->{'checked'}
Truth table100%2/2
A
A= $args->{'checked'}
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 243 | ▶ | $mime ||= 'text/plain'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$mime ||= "text/plain"
MC/DC100%1/1
$mime ||= "text/plain"
$mime
Truth table100%2/2
A
A= $mime
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 243 | $mime = $self->type($mime); | |||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 243 | ▶ | my $default_charset = exists $args->{charset} ? $args->{charset} : 'PERL'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | 243 | ▶ | $mime->attribute(charset => $default_charset) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$default_charset and $mime =~ m[^text/]i and not $mime->attribute("charset")
$default_charset and $mime =~ m[^text/]i
MC/DC100%3/3
$default_charset and $mime =~ m[^text/]i and not $mime->attribute("charset")
$default_charset
$mime =~ m[^text/]i
not $mime->attribute("charset")
Truth table100%4/4
A and B and not(C)
A= $default_charsetB= $mime =~ m[^text/]iC= not $mime->attribute("charset")
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | if $default_charset | ||||||||||||||||||||||||||||||||||||||||||
| 143 | && $mime =~ m!^text/!i | ||||||||||||||||||||||||||||||||||||||||||
| 144 | && !$mime->attribute('charset'); | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 243 | ▶ | $self->transferEncoding($transfer) if defined $transfer; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 243 | ▶ | $self->disposition($disp) if defined $disp; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 243 | ▶ | $self->description($descr) if defined $descr; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 243 | ▶ | $self->contentId($cid) if defined $cid; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 243 | $self->type($mime); | |||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | 243 | ▶ | $self->{MMB_eol} = $args->{eol} || 'NATIVE'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'eol'} || 'NATIVE'
MC/DC100%1/1
$args->{'eol'} || 'NATIVE'
$args->{'eol'}
Truth table100%2/2
A
A= $args->{'eol'}
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | # Set message where the body belongs to. | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | $self->message($args->{message}) | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 243 | ▶ | if defined $args->{message}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 243 | $self->{MMB_seqnr} = $body_count++; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 243 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | sub clone() {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | sub decoded(@) | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 25 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decoded: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 25 | $self->encode(charset => 'PERL', transfer_encoding => 'none', @_); | |||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | sub eol(;$) | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 2 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
eol: called CC=14 SCAR=33.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 2 | ▶ | return $self->{MMB_eol} unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | my $eol = shift; | |||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | ▶ | if($eol eq 'NATIVE') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | ▶ | { $eol = $^O =~ m/^win/i ? 'CRLF' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | : $^O =~ m/^mac/i ? 'CR' | ||||||||||||||||||||||||||||||||||||||||||
| 184 | : 'LF'; | ||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 1 | ▶ | return $self if $eol eq $self->{MMB_eol} && $self->checked; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$eol eq $self->{"MMB_eol"} and $self->checked
MC/DC0%0/2
$eol eq $self->{"MMB_eol"} and $self->checked
$eol eq $self->{"MMB_eol"}
$self->checked
Truth table33%1/3
A and B
A= $eol eq $self->{"MMB_eol"}B= $self->checked
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 1 | my $lines = $self->lines; | |||||||||||||||||||||||||||||||||||||||||
| 189 | 1 | ▶ | if(@$lines) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | { # sometimes texts lack \n on last line | ||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | $lines->[-1] .= "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | ▶ | if($eol eq 'CR') {s/[\015\012]+$/\015/ for @$lines} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 1 | elsif($eol eq 'LF') {s/[\015\012]+$/\012/ for @$lines} | |||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | elsif($eol eq 'CRLF') {s/[\015\012]+$/\015\012/ for @$lines} | |||||||||||||||||||||||||||||||||||||||||
| 197 | else | ||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | { $self->log(WARNING => "Unknown line terminator $eol ignored"); | |||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | return $self->eol('NATIVE'); | |||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 1 | (ref $self)->new(based_on => $self, eol => $eol, data => $lines); | |||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | sub message(;$) | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 167 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
message: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 167 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 156 | ▶ | { if($self->{MMB_message} = shift) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | 156 | { weaken $self->{MMB_message}; | |||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 167 | $self->{MMB_message}; | |||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | sub isDelayed() {0} | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | sub isMultipart() {0} | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | sub isNested() {0} | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | sub partNumberOf($) | ||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | { shift->log(ERROR => 'part number needs multi-part or nested'); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
partNumberOf: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | 'ERROR'; | |||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | sub type(;$) | ||||||||||||||||||||||||||||||||||||||||||
| 238 | 1070 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 1070 | ▶ | return $self->{MMB_type} if !@_ && defined $self->{MMB_type}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not @_ and defined $self->{"MMB_type"}
MC/DC50%1/2
not @_ and defined $self->{"MMB_type"}
not @_
defined $self->{"MMB_type"}
Truth table66%2/3
not(A) and B
A= not @_B= defined $self->{"MMB_type"}
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | 526 | delete $self->{MMB_mime}; | |||||||||||||||||||||||||||||||||||||||||
| 242 | 526 | ▶ | my $type = shift // 'text/plain'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() // "text/plain"
MC/DC100%1/1
shift() // "text/plain"
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 526 | ▶ | $self->{MMB_type} = ref $type ? $type->clone | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | : Mail::Message::Field->new('Content-Type' => $type); | ||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | sub mimeType() | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 50 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mimeType: called CC=5 SCAR=17.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 50 | ▶ | return $self->{MMB_mime} if exists $self->{MMB_mime}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | 30 | my $field = $self->{MMB_type}; | |||||||||||||||||||||||||||||||||||||||||
| 254 | 30 | ▶ | my $body = defined $field ? $field->body : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 30 | ▶ | return $self->{MMB_mime} = $mime_plain | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | unless length $body; | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | $self->{MMB_mime} | ||||||||||||||||||||||||||||||||||||||||||
| 260 | 30 | ▶ | = $mime_types->type($body) || MIME::Type->new(type => $body); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$mime_types->type($body) || 'MIME::Type'->new('type', $body)
MC/DC0%0/2
$mime_types->type($body) || 'MIME::Type'->new('type', $body)
$mime_types->type($body)
'MIME::Type'->new('type', $body)
Truth table33%1/3
A || B
A= $mime_types->type($body)B= 'MIME::Type'->new('type', $body)
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | 66 | ▶ | sub charset() { shift->type->attribute('charset') } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
charset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | sub transferEncoding(;$) | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 573 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
transferEncoding: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 573 | ▶ | return $self->{MMB_transfer} if !@_ && defined $self->{MMB_transfer}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not @_ and defined $self->{"MMB_transfer"}
MC/DC100%2/2
not @_ and defined $self->{"MMB_transfer"}
not @_
defined $self->{"MMB_transfer"}
Truth table100%3/3
not(A) and B
A= not @_B= defined $self->{"MMB_transfer"}
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 271 | ▶ | my $set = defined $_[0] ? shift : 'none'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | 271 | ▶ | $self->{MMB_transfer} = ref $set ? $set->clone | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | : Mail::Message::Field->new('Content-Transfer-Encoding' => $set); | ||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | sub description(;$) | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 396 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
description: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | 396 | ▶ | return $self->{MMB_description} if !@_ && $self->{MMB_description}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not @_ and $self->{"MMB_description"}
MC/DC100%2/2
not @_ and $self->{"MMB_description"}
not @_
$self->{"MMB_description"}
Truth table100%3/3
not(A) and B
A= not @_B= $self->{"MMB_description"}
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | 229 | ▶ | my $disp = defined $_[0] ? shift : 'none'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 229 | ▶ | $self->{MMB_description} = ref $disp ? $disp->clone | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | : Mail::Message::Field->new('Content-Description' => $disp); | ||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | sub disposition(;$) | ||||||||||||||||||||||||||||||||||||||||||
| 288 | 398 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disposition: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 398 | ▶ | return $self->{MMB_disposition} if !@_ && $self->{MMB_disposition}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not @_ and $self->{"MMB_disposition"}
MC/DC100%2/2
not @_ and $self->{"MMB_disposition"}
not @_
$self->{"MMB_disposition"}
Truth table100%3/3
not(A) and B
A= not @_B= $self->{"MMB_disposition"}
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 229 | ▶ | my $disp = defined $_[0] ? shift : 'none'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 229 | ▶ | $self->{MMB_disposition} = ref $disp ? $disp->clone | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | : Mail::Message::Field->new('Content-Disposition' => $disp); | ||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | sub contentId(;$) | ||||||||||||||||||||||||||||||||||||||||||
| 299 | 396 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
contentId: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | 396 | ▶ | return $self->{MMB_id} if !@_ && $self->{MMB_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not @_ and $self->{"MMB_id"}
MC/DC100%2/2
not @_ and $self->{"MMB_id"}
not @_
$self->{"MMB_id"}
Truth table100%3/3
not(A) and B
A= not @_B= $self->{"MMB_id"}
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 229 | ▶ | my $cid = defined $_[0] ? shift : 'none'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | 229 | ▶ | $self->{MMB_id} = ref $cid ? $cid->clone | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | : Mail::Message::Field->new('Content-ID' => $cid); | ||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | sub checked(;$) | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 114 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checked: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 114 | ▶ | @_ ? ($self->{MMB_checked} = shift) : $self->{MMB_checked}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | sub nrLines(@) {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nrLines: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | sub size(@) {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
size: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | sub string() {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
string: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | sub string_unless_carp() | ||||||||||||||||||||||||||||||||||||||||||
| 325 | 25 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
string_unless_carp: called CC=2 SCAR=9.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 25 | ▶ | return $self->string unless (caller)[0] eq 'Carp'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | (my $class = ref $self) =~ s/^Mail::Message/MM/; | |||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | "$class object"; | |||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | sub lines() {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lines: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | sub file(;$) {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | sub print(;$) {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | sub printEscapedFrom($) {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
printEscapedFrom: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | sub write(@) | ||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | my $filename = $args{filename}; | |||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | die "No filename for write() body" unless defined $filename; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | ▶ | open OUT, '>', $filename or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | $self->print(\*OUT); | |||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | close OUT or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | ▶ | sub endsOnNewline() {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
endsOnNewline: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | sub stripTrailingNewline() {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stripTrailingNewline: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | sub read(@) {shift->notImplemented} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | sub contentInfoTo($) | ||||||||||||||||||||||||||||||||||||||||||
| 369 | 90 | ▶ | { my ($self, $head) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
contentInfoTo: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 90 | ▶ | return unless defined $head; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | 90 | my $lines = $self->nrLines; | |||||||||||||||||||||||||||||||||||||||||
| 373 | 90 | my $size = $self->size; | |||||||||||||||||||||||||||||||||||||||||
| 374 | 90 | ▶ | $size += $lines if $Mail::Message::crlf_platform; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 90 | $head->set($self->type); | |||||||||||||||||||||||||||||||||||||||||
| 377 | 90 | $head->set($self->transferEncoding); | |||||||||||||||||||||||||||||||||||||||||
| 378 | 90 | $head->set($self->disposition); | |||||||||||||||||||||||||||||||||||||||||
| 379 | 90 | $head->set($self->description); | |||||||||||||||||||||||||||||||||||||||||
| 380 | 90 | $head->set($self->contentId); | |||||||||||||||||||||||||||||||||||||||||
| 381 | 90 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | sub contentInfoFrom($) | ||||||||||||||||||||||||||||||||||||||||||
| 386 | 40 | ▶ | { my ($self, $head) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
contentInfoFrom: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | 40 | $self->type($head->get('Content-Type', 0)); | |||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | my ($te, $disp, $desc, $cid) | ||||||||||||||||||||||||||||||||||||||||||
| 391 | 40 | ▶ | = map { my $x = $head->get("Content-$_") || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$head->get("Content-$_") || ''
MC/DC100%1/1
$head->get("Content-$_") || ''
$head->get("Content-$_")
Truth table100%2/2
A
A= $head->get("Content-$_")
| |||||||||||||||||||||||||||||||||||||||||||
| 392 | 160 | s/^\s+//,s/\s+$// for $x; | |||||||||||||||||||||||||||||||||||||||||
| 393 | 160 | ▶ | length $x ? $x : undef | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | } qw/Transfer-Encoding Disposition Description ID/; | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | 40 | $self->transferEncoding($te); | |||||||||||||||||||||||||||||||||||||||||
| 397 | 40 | $self->disposition($disp); | |||||||||||||||||||||||||||||||||||||||||
| 398 | 40 | $self->description($desc); | |||||||||||||||||||||||||||||||||||||||||
| 399 | 40 | $self->contentId($cid); | |||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | 40 | delete $self->{MMB_mime}; | |||||||||||||||||||||||||||||||||||||||||
| 402 | 40 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | sub modified(;$) | ||||||||||||||||||||||||||||||||||||||||||
| 408 | 13 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
modified: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 409 | 13 | ▶ | return $self->isModified unless @_; # compat 2.036 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 13 | $self->{MMB_modified} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | sub isModified() { shift->{MMB_modified} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isModified: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | sub fileLocation(;@) | ||||||||||||||||||||||||||||||||||||||||||
| 418 | 46 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fileLocation: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 419 | 46 | ▶ | return @$self{ qw/MMB_begin MMB_end/ } unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | 39 | @$self{ qw/MMB_begin MMB_end/ } = @_; | |||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||
| 424 | sub moveLocation($) | ||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | { my ($self, $dist) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
moveLocation: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | $self->{MMB_begin} -= $dist; | |||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | $self->{MMB_end} -= $dist; | |||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | 2 | ▶ | sub load() {shift} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | 34 | my @in_encode = qw/check encode encoded eol isBinary isText unify | |||||||||||||||||||||||||||||||||||||||||
| 438 | dispositionFilename/; | ||||||||||||||||||||||||||||||||||||||||||
| 439 | 34 | my %in_module = map { ($_ => 'encode') } @in_encode; | |||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | sub AUTOLOAD(@) | ||||||||||||||||||||||||||||||||||||||||||
| 442 | 15 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | 15 | our $AUTOLOAD; | |||||||||||||||||||||||||||||||||||||||||
| 444 | 15 | (my $call = $AUTOLOAD) =~ s/.*\:\://g; | |||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | 15 | ▶ | my $mod = $in_module{$call} || 'construct'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$in_module{$call} || 'construct'
MC/DC100%1/1
$in_module{$call} || 'construct'
$in_module{$call}
Truth table100%2/2
A
A= $in_module{$call}
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | 15 | ▶ | if($mod eq 'encode'){ require Mail::Message::Body::Encode } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 448 | 3 | else { require Mail::Message::Body::Construct } | |||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||
| 450 | 34 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 451 | 15 | ▶ | return $self->$call(@_) if $self->can($call); # now loaded | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | # AUTOLOAD inheritance is a pain | ||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | confess "Method $call() is not defined for a ", ref $self; | |||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||
| 460 | 34 | 1; | |||||||||||||||||||||||||||||||||||||||||