Message/Body/Delayed.pm

filter: Statementstmt 68.4% 39 / 57 Branchbran 20.0% 2 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 57.1% 12 / 21 Podpod 81.8% 9 / 11 totaltotal 59.6% 62 / 104 CC 7 SCAR 11.9
CC
7
Cov
59%
modified
12.0
string_unless_carp
6.0
fileLocation
6.0
CRAP 3.3
« Box/Tie.pm ↑ Summary Message/Dummy.pm »
1 # Copyrights 2001-2020 by [Mark Overmeer].
2 # For other contributors see ChangeLog.
3 # See the manual pages for details on the licensing terms.
4 # Pod stripped from pm file by OODoc 2.02.
5 # This code is part of distribution Mail-Box. 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::Delayed;
10 28 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 28 $VERSION = '3.009';
12  
13 28 ▶use base 'Mail::Reporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 28 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 28 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 use Object::Realize::Later
19 28 becomes => 'Mail::Message::Body',
20 realize => 'load',
21 warn_realization => 0,
22 28 ▶ believe_caller => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 28 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 28 ▶use Scalar::Util 'weaken';
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27  
28 use overload '""' => 'string_unless_carp'
29 0 ▶ , bool => sub {1}
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 28 ▶ , '@{}' => sub {shift->load->lines};
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine __ANON__: not called CC=1 SCAR=0.2
31  
32 #------------------------------------------
33  
34  
35 sub init($)
36 135 ▶{ my ($self, $args) = @_;
Subroutine init: called CC=2 SCAR=7.0
Pod undocumented
37 135 $self->SUPER::init($args);
38  
39 135 $self->{MMB_seqnr} = -1; # for overloaded body comparison
40 $self->{MMBD_message} = $args->{message}
41 135 ▶ or $self->log(INTERNAL => "A message must be specified to a delayed body.");
Branch: 1 branch
BranchTrueFalseTotal
$self->{"MMBD_message"} = $args->{"message"} or $self->log("INTERNAL", "A message must be specified to a delayed body.") 0 135 135
42  
43 135 weaken($self->{MMBD_message});
44 135 $self;
45 }
46  
47 #------------------------------------------
48  
49  
50 0 ▶sub message() { shift->{MMBD_message} }
Subroutine message: not called CC=1 SCAR=6.9
Pod documented
51  
52 #------------------------------------------
53  
54  
55 sub modified(;$)
56 0 ▶{ return 0 if @_==1 || !$_[1];
Subroutine modified: not called CC=3 SCAR=24.8
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 or not $_[1] 0 0 0
Condition0%0/3
@_ == 1 or not $_[1]
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ == 1 or not $_[1]
@_ == 1 not $_[1]
Truth table0%0/3
A or not(B)
A= @_ == 1B= not $_[1]
ABresult
1X1
011
000
57 0 shift->forceRealize(shift);
58 }
59  
60  
61 sub isModified() {0}
62 sub isDelayed() {1}
63 0 ▶sub isMultipart() {shift->message->head->isMultipart}
Subroutine isMultipart: not called CC=1 SCAR=6.9
Pod documented
64 135 ▶sub guessSize() {shift->{MMBD_size}}
Subroutine guessSize: called CC=1 SCAR=0.0
Pod documented
65  
66  
67 sub nrLines()
68 90 ▶{ my ($self) = @_;
Subroutine nrLines: called CC=2 SCAR=7.2
Pod documented
69 defined $self->{MMBD_lines}
70 ? $self->{MMBD_lines}
71 90 ▶ : $_[0]->forceRealize->nrLines;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'MMBD_lines'} ? : 90 0 90
72 }
73  
74 sub string_unless_carp()
75 0 ▶{ my $self = shift;
Subroutine string_unless_carp: not called CC=2 SCAR=17.9
Pod undocumented
76 0 ▶ return $self->load->string if (caller)[0] ne 'Carp';
Branch: 1 branch
BranchTrueFalseTotal
if (caller)[0] ne "Carp" 0 0 0
77  
78 0 (my $class = ref $self) =~ s/^Mail::Message/MM/g;
79 0 "$class object";
80 }
81  
82 #------------------------------------------
83  
84  
85 sub read($$;$@)
86 135 ▶{ my ($self, $parser, $head, $bodytype) = splice @_, 0, 4;
Subroutine read: called CC=1 SCAR=0.0
Pod documented
87 135 $self->{MMBD_parser} = $parser;
88  
89 135 @$self{ qw/MMBD_begin MMBD_end MMBD_size MMBD_lines/ }
90 = $parser->bodyDelayed(@_);
91  
92 135 $self;
93 }
94  
95  
96 sub fileLocation(;@) {
97 0 ▶ my $self = shift;
Subroutine fileLocation: not called CC=2 SCAR=17.9
Pod documented
98 0 ▶ return @$self{ qw/MMBD_begin MMBD_end/ } unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
99 0 @$self{ qw/MMBD_begin MMBD_end/ } = @_;
100 }
101  
102  
103 sub moveLocation($)
104 0 ▶{ my ($self, $dist) = @_;
Subroutine moveLocation: not called CC=1 SCAR=6.9
Pod documented
105 0 $self->{MMBD_begin} -= $dist;
106 0 $self->{MMBD_end} -= $dist;
107 0 $self;
108 }
109  
110  
111 0 ▶sub load() {$_[0] = $_[0]->message->loadBody}
Subroutine load: not called CC=1 SCAR=6.9
Pod documented
112  
113 #------------------------------------------
114  
115  
116 28 1;
« Box/Tie.pm ↑ Summary Message/Dummy.pm »