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