Message/Construct/Text.pm

filter: Statementstmt 86.0% 37 / 43 Branchbran 70.0% 14 / 20 Conditioncond 57.1% 4 / 7 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 87.5% 7 / 8 Podpod 100% 4 / 4 totaltotal 77.9% 67 / 86 CC 15 SCAR 23.4
CC
15
Cov
79%
printStructure
15.5
lines
2.0
file
2.0
CRAP 10.3
« Message/Body/Multipart.pm ↑ Summary Message/Field/Addresses.pm »
1 # Copyrights 2001-2022 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;
10 4 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 $VERSION = '3.012';
12  
13  
14 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 4 ▶use IO::Lines;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19  
20 sub string()
21 5 ▶{ my $self = shift;
Subroutine string: called CC=1 SCAR=0.0
Pod documented
22 5 $self->head->string . $self->body->string;
23 }
24  
25 #------------------------------------------
26  
27  
28 sub lines()
29 8 ▶{ my $self = shift;
Subroutine lines: called CC=2 SCAR=7.0
Pod documented
30 8 my @lines;
31 8 my $file = IO::Lines->new(\@lines);
32 8 $self->print($file);
33 8 ▶ wantarray ? @lines : \@lines;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 8 0 8
34 }
35  
36 #------------------------------------------
37  
38  
39 sub file()
40 0 ▶{ my $self = shift;
Subroutine file: not called CC=1 SCAR=6.9
Pod documented
41 0 my @lines;
42 0 my $file = IO::Lines->new(\@lines);
43 0 $self->print($file);
44 0 $file->seek(0,0);
45 0 $file;
46 }
47  
48  
49 sub printStructure(;$$)
50 6 ▶{ my $self = shift;
Subroutine printStructure: called CC=14 SCAR=27.4
Pod documented
51  
52 6 ▶ my $indent
Branch: 2 branches
BranchTrueFalseTotal
@_ == 2 ? : 5 1 6
defined $_[0] && !ref($_[0]) ? : 0 1 1
Condition33%1/3
defined $_[0] and not ref $_[0]
!ll&&!rl&&r
010
MC/DC0%0/2
defined $_[0] and not ref $_[0]
defined $_[0] not ref $_[0]
Truth table33%1/3
A and not(B)
A= defined $_[0]B= not ref $_[0]
ABresult
0X0
100
111
53 = @_==2 ? pop
54 : defined $_[0] && !ref $_[0] ? shift
55 : '';
56  
57 6 ▶ my $fh = @_ ? shift : select;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 6 0 6
58  
59 6 my $buffer; # only filled if filehandle==undef
60 6 ▶ open $fh, '>:raw', \$buffer unless defined $fh;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $fh 0 6 6
61  
62 6 ▶ my $subject = $self->get('Subject') || '';
Condition100%2/2
$self->get('Subject') || ''
l!l
24
MC/DC100%1/1
$self->get('Subject') || ''
$self->get('Subject')
Truth table100%2/2
A
A= $self->get('Subject')
Aresult
11
00
63 6 ▶ $subject = ": $subject" if length $subject;
Branch: 1 branch
BranchTrueFalseTotal
if length $subject 2 4 6
64  
65 6 ▶ my $type = $self->get('Content-Type', 0) || '';
Condition50%1/2
$self->get('Content-Type', 0) || ''
l!l
60
MC/DC0%0/1
$self->get('Content-Type', 0) || ''
$self->get('Content-Type', 0)
Truth table50%1/2
A
A= $self->get('Content-Type', 0)
Aresult
11
00
66 6 my $size = $self->size;
67 6 ▶ my $deleted = $self->label('deleted') ? ', deleted' : '';
Branch: 1 branch
BranchTrueFalseTotal
$self->label('deleted') ? : 0 6 6
68  
69 6 my $text = "$indent$type$subject ($size bytes$deleted)\n";
70 6 ▶ ref $fh eq 'GLOB' ? (print $fh $text) : $fh->print($text);
Branch: 1 branch
BranchTrueFalseTotal
ref $fh eq 'GLOB' ? : 0 6 6
71  
72 6 my $body = $self->body;
73 my @parts
74 6 ▶ = $body->isNested ? ($body->nested)
Branch: 2 branches
BranchTrueFalseTotal
$body->isNested ? : 1 5 6
$body->isMultipart ? : 2 3 5
75 : $body->isMultipart ? $body->parts
76 : ();
77  
78 $_->printStructure($fh, $indent.' ')
79 6 for @parts;
80  
81 6 $buffer;
82 }
83
84  
85 4 1;
« Message/Body/Multipart.pm ↑ Summary Message/Field/Addresses.pm »