blib/lib/OPP/Proc/Fields.pm

filter: Statementstmt 52.1% 12 / 23 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 40.5% 15 / 37 CC 6 SCAR 33.4
CC
6
Cov
39%
process
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 28.3
« blib/lib/OPP/Proc/Whois.pm ↑ Summary blib/lib/OPP/Proc/Discovery.pm »
1 #
2 # $Id: Fields.pm,v 17cc8d9dc427 2023/03/07 06:24:43 gomor $
3 #
4 package OPP::Proc::Fields;
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use base qw(OPP::Proc);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 __PACKAGE__->cgBuildIndices;
10  
11 1 our $VERSION = '1.00';
12  
13 #
14 # | fields ip,protocol,domain,app.http.component.product
15 #
16 sub process {
17 0 ▶ my $self = shift;
Subroutine process: not called CC=6 SCAR=37.4
Pod undocumented
18 0 my ($input) = @_;
19  
20 0 ▶ my $keep = $self->options->{0} || {};
Condition0%0/2
$self->options->{'0'} || {}
l!l
00
MC/DC0%0/1
$self->options->{'0'} || {}
$self->options->{'0'}
Truth table0%0/2
A
A= $self->options->{'0'}
Aresult
11
00
21  
22 # Build list of fields to be kept from input argument:
23 0 ▶ if (defined($keep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $keep) 0 0 0
24 0 $keep = { map { $_ => 1 } split(/\s*,\s*/, $keep) };
25 }
26  
27 # Get list of full input field names:
28 0 my $fields = $self->fields($input);
29  
30 # Iterate over all input fields and delete those not wanted for being kept:
31 0 for my $k (@$fields) {
32 0 ▶ $self->delete($input, $k) if !$keep->{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless $keep->{$k} 0 0 0
33 }
34  
35 0 ▶ $self->output->add($input) if %$input > 0;
Branch: 1 branch
BranchTrueFalseTotal
if %$input > 0 0 0 0
36  
37 0 return 1;
38 }
39  
40 1 1;
41  
42 __END__
« blib/lib/OPP/Proc/Whois.pm ↑ Summary blib/lib/OPP/Proc/Discovery.pm »