FromMail/Head.pm

filter: Statementstmt 46.1% 18 / 39 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 11 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 71.4% 5 / 7 Podpod 50.0% 1 / 2 totaltotal 31.5% 24 / 76 CC 10 SCAR 39.5
CC
10
Cov
30%
fields
90.0
init
6.0
BEGIN
1.0
CRAP 51.7
« FromMail.pm ↑ Summary FromMail/Message.pm »
1 # This code is part of Perl distribution HTML-FromMail version 4.00.
2 # The POD got stripped from this file by OODoc version 3.05.
3 # For contributors see file ChangeLog.
4  
5 # This software is copyright (c) 2003-2025 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 HTML::FromMail::Head;{
13 1 our $VERSION = '4.00';
14 }
15  
16 1 ▶use base 'HTML::FromMail::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Log::Report 'html-frommail';
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 ▶use HTML::FromMail::Field ();
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 #--------------------
26  
27 sub init($)
28 0 ▶{ my ($self, $args) = @_;
Subroutine init: not called CC=2 SCAR=17.9
Pod undocumented
29 0 ▶ $args->{topic} ||= 'head';
Condition0%0/2
$args->{"topic"} ||= "head"
l!l
00
MC/DC0%0/1
$args->{"topic"} ||= "head"
$args->{"topic"}
Truth table0%0/2
A
A= $args->{"topic"}
Aresult
11
00
30 0 $self->SUPER::init($args);
31 }
32  
33 #-----------
34  
35 #-----------
36  
37 sub fields($$)
38 0 ▶{ my ($thing, $realhead, $args) = @_;
Subroutine fields: not called CC=9 SCAR=45.0
Pod documented
39 0 my $head = $realhead->clone; # we are probably going to remove lines
40  
41 0 my $lg = $args->{remove_list_group};
42 0 ▶ $head->removeListGroup if $lg || !defined $lg;
Branch: 1 branch
BranchTrueFalseTotal
if $lg or not defined $lg 0 0 0
Condition0%0/3
$lg or not defined $lg
l!l&&r!l&&!r
000
MC/DC0%0/2
$lg or not defined $lg
$lg not defined $lg
Truth table0%0/3
A or not(B)
A= $lgB= not defined $lg
ABresult
1X1
011
000
43  
44 0 my $sg = $args->{remove_spam_groups};
45 0 ▶ $head->removeSpamGroups if $sg || !defined $sg;
Branch: 1 branch
BranchTrueFalseTotal
if $sg or not defined $sg 0 0 0
Condition0%0/3
$sg or not defined $sg
l!l&&r!l&&!r
000
MC/DC0%0/2
$sg or not defined $sg
$sg not defined $sg
Truth table0%0/3
A or not(B)
A= $sgB= not defined $sg
ABresult
1X1
011
000
46  
47 0 my $rg = $args->{remove_resent_groups};
48 0 ▶ $head->removeResentGroups if $rg || !defined $rg;
Branch: 1 branch
BranchTrueFalseTotal
if $rg or not defined $rg 0 0 0
Condition0%0/3
$rg or not defined $rg
l!l&&r!l&&!r
000
MC/DC0%0/2
$rg or not defined $rg
$rg not defined $rg
Truth table0%0/3
A or not(B)
A= $rgB= not defined $rg
ABresult
1X1
011
000
49  
50 0 my @fields;
51 0 ▶ if(my $select = $args->{select})
Branch: 2 branches
BranchTrueFalseTotal
if (my $select = $args->{'select'}) { } 0 0 0
elsif (my $ignore = $args->{'ignore'}) { } 0 0 0
52 0 { my @select = split /\|/, $select;
53 0 @fields = map $head->grepNames($_), @select;
54 }
55 elsif(my $ignore = $args->{ignore})
56 0 { my @ignore = split /\|/, $ignore;
57 0 local $" = ")|(?:";
58 0 my $skip = qr/^(?:@ignore)/i;
59 0 @fields = grep $_->name !~ $skip, $head->orderedFields;
60 }
61 else
62 0 { @fields = $head->orderedFields;
63 }
64  
65 0 map $_->study, @fields;
66 }
67  
68 1 1;
« FromMail.pm ↑ Summary FromMail/Message.pm »