Message/Head/Subset.pm

filter: Statementstmt 42.5% 20 / 47 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 54.5% 6 / 11 Podpod 80.0% 4 / 5 totaltotal 32.2% 30 / 93 CC 14 SCAR 30.4
CC
14
Cov
27%
guessTimestamp
42.0
guessBodySize
30.0
get
20.0
CRAP 20.9
« Box/Dir/Message.pm ↑ Summary Box/Mbox.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::Head::Subset;
10 9 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 9 $VERSION = '3.009';
12  
13 9 ▶use base 'Mail::Message::Head';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 use Object::Realize::Later
19 9 becomes => 'Mail::Message::Head::Complete',
20 realize => 'load',
21 9 ▶ believe_caller => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 9 ▶use Date::Parse qw(str2time);
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25  
26 sub count($)
27 0 ▶{ my ($self, $name) = @_;
Subroutine count: not called CC=2 SCAR=17.9
Pod documented
28 0 ▶ my @values = $self->get($name)
Branch: 1 branch
BranchTrueFalseTotal
my(@values) = $self->get($name) or return $self->load->count($name) 0 0 0
29 or return $self->load->count($name);
30 0 scalar @values;
31 }
32  
33  
34 sub get($;$)
35 0 ▶{ my $self = shift;
Subroutine get: not called CC=4 SCAR=30.0
Pod documented
36
37 0 ▶ if(wantarray)
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
38 0 { my @values = $self->SUPER::get(@_);
39 0 ▶ return @values if @values;
Branch: 1 branch
BranchTrueFalseTotal
if @values 0 0 0
40 }
41 else
42 0 { my $value = $self->SUPER::get(@_);
43 0 ▶ return $value if defined $value;
Branch: 1 branch
BranchTrueFalseTotal
if defined $value 0 0 0
44 }
45  
46 0 $self->load->get(@_);
47 }
48  
49  
50 #-------------------------------------------
51  
52 sub guessBodySize()
53 0 ▶{ my $self = shift;
Subroutine guessBodySize: not called CC=5 SCAR=34.0
Pod documented
54  
55 0 my $cl = $self->SUPER::get('Content-Length');
56 0 ▶ return $1 if defined $cl && $cl =~ m/(\d+)/;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cl and $cl =~ /(\d+)/ 0 0 0
Condition0%0/3
defined $cl and $cl =~ /(\d+)/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $cl and $cl =~ /(\d+)/
defined $cl $cl =~ /(\d+)/
Truth table0%0/3
A and B
A= defined $clB= $cl =~ /(\d+)/
ABresult
0X0
100
111
57  
58 0 my $lines = $self->SUPER::get('Lines'); # 40 chars per lines
59 0 ▶ return $1*40 if defined $lines && $lines =~ m/(\d+)/;
Branch: 1 branch
BranchTrueFalseTotal
if defined $lines and $lines =~ /(\d+)/ 0 0 0
Condition0%0/3
defined $lines and $lines =~ /(\d+)/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $lines and $lines =~ /(\d+)/
defined $lines $lines =~ /(\d+)/
Truth table0%0/3
A and B
A= defined $linesB= $lines =~ /(\d+)/
ABresult
0X0
100
111
60  
61 0 undef;
62 }
63  
64 #-------------------------------------------
65 # Be careful not to trigger loading: this is not the thoroughness
66 # we want from this method.
67  
68 sub guessTimestamp()
69 0 ▶{ my $self = shift;
Subroutine guessTimestamp: not called CC=6 SCAR=37.4
Pod undocumented
70 0 ▶ return $self->{MMHS_timestamp} if $self->{MMHS_timestamp};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"MMHS_timestamp"} 0 0 0
71  
72 0 my $stamp;
73 0 ▶ if(my $date = $self->SUPER::get('date'))
Branch: 1 branch
BranchTrueFalseTotal
if (my $date = $self->SUPER::get("date")) 0 0 0
74 0 { $stamp = str2time($date, 'GMT');
75 }
76  
77 0 ▶ unless($stamp)
Branch: 1 branch
BranchTrueFalseTotal
unless ($stamp) 0 0 0
78 0 { foreach ($self->SUPER::get('received'))
79 0 { $stamp = str2time($_, 'GMT');
80 0 ▶ last if $stamp;
Branch: 1 branch
BranchTrueFalseTotal
if $stamp 0 0 0
81 }
82 }
83  
84 0 $self->{MMHS_timestamp} = $stamp;
85 }
86  
87 #-------------------------------------------
88  
89 0 ▶sub load() { $_[0] = $_[0]->message->loadHead }
Subroutine load: not called CC=1 SCAR=6.9
Pod documented
90  
91 9 1;
« Box/Dir/Message.pm ↑ Summary Box/Mbox.pm »