Message/Head/Subset.pm

filter: Statementstmt 44.6% 21 / 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 33.3% 31 / 93 CC 14 SCAR 30.4
CC
14
Cov
29%
guessTimestamp
42.0
guessBodySize
30.0
get
20.0
CRAP 20.9
« Box/Search.pm ↑ Summary Box/Test.pm »
1 # This code is part of Perl distribution Mail-Box version 4.02.
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::Head::Subset;{
13 11 our $VERSION = '4.02';
14 }
15  
16 11 ▶use parent 'Mail::Message::Head';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 11 ▶use Log::Report 'mail-box', import => [ qw// ];
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 use Object::Realize::Later
24 11 ▶ becomes => 'Mail::Message::Head::Complete',
Subroutine BEGIN: called CC=1 SCAR=0.0
25 realize => 'load',
26 11 believe_caller => 1;
27  
28 11 ▶use Date::Parse qw/str2time/;
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 #--------------------
31  
32 sub count($)
33 0 ▶{ my ($self, $name) = @_;
Subroutine count: not called CC=2 SCAR=17.9
Pod documented
34 0 ▶ my @values = $self->get($name)
Branch: 1 branch
BranchTrueFalseTotal
my(@values) = $self->get($name) or return $self->load->count($name) 0 0 0
35 or return $self->load->count($name);
36 0 scalar @values;
37 }
38  
39  
40 sub get($;$)
41 0 ▶{ my $self = shift;
Subroutine get: not called CC=4 SCAR=30.0
Pod documented
42  
43 0 ▶ if(wantarray)
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
44 0 { my @values = $self->SUPER::get(@_);
45 0 ▶ return @values if @values;
Branch: 1 branch
BranchTrueFalseTotal
if @values 0 0 0
46 }
47 else
48 0 { my $value = $self->SUPER::get(@_);
49 0 ▶ return $value if defined $value;
Branch: 1 branch
BranchTrueFalseTotal
if defined $value 0 0 0
50 }
51  
52 0 $self->load->get(@_);
53 }
54  
55  
56 #--------------------
57  
58 sub guessBodySize()
59 0 ▶{ my $self = shift;
Subroutine guessBodySize: not called CC=5 SCAR=34.0
Pod documented
60  
61 0 my $cl = $self->SUPER::get('Content-Length');
62 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
63  
64 0 my $lines = $self->SUPER::get('Lines'); # 40 chars per lines
65 0 ▶ defined $lines && $lines =~ m/(\d+)/ ? $1 * 40 : undef
Branch: 1 branch
BranchTrueFalseTotal
defined $lines && $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
66 }
67  
68 # Be careful not to trigger loading: this is not the thoroughness
69 # we want from this method.
70  
71 sub guessTimestamp()
72 0 ▶{ my $self = shift;
Subroutine guessTimestamp: not called CC=6 SCAR=37.4
Pod undocumented
73 0 ▶ return $self->{MMHS_timestamp} if $self->{MMHS_timestamp};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"MMHS_timestamp"} 0 0 0
74  
75 0 my $stamp;
76 0 ▶ if(my $date = $self->SUPER::get('date'))
Branch: 1 branch
BranchTrueFalseTotal
if (my $date = $self->SUPER::get("date")) 0 0 0
77 0 { $stamp = str2time($date, 'GMT');
78 }
79  
80 0 ▶ unless($stamp)
Branch: 1 branch
BranchTrueFalseTotal
unless ($stamp) 0 0 0
81 0 { foreach my $time ($self->SUPER::get('received'))
82 0 { $stamp = str2time($time, 'GMT');
83 0 ▶ last if $stamp;
Branch: 1 branch
BranchTrueFalseTotal
if $stamp 0 0 0
84 }
85 }
86  
87 0 $self->{MMHS_timestamp} = $stamp;
88 }
89  
90 #--------------------
91  
92 0 ▶sub load() { $_[0] = $_[0]->message->loadHead }
Subroutine load: not called CC=1 SCAR=6.9
Pod documented
93  
94 11 1;
« Box/Search.pm ↑ Summary Box/Test.pm »