blib/lib/OPP/Proc/Filter.pm

filter: Statementstmt 40.0% 12 / 30 Branchbran 0.0% 0 / 28 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 23.8% 15 / 63 CC 17 SCAR 55.6
CC
17
Cov
21%
process
306.0
BEGIN
1.0
BEGIN
1.0
CRAP 260.2
« blib/lib/Onyphe/Api.pm ↑ Summary blib/lib/OPP/Proc/Blocklist.pm »
1 #
2 # $Id: Filter.pm,v 8ee92019aa06 2023/03/07 16:29:38 gomor $
3 #
4 package OPP::Proc::Filter;
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 # | fieldcount domain | filter domaincount:>=3
15 #
16 sub process {
17 0 ▶ my $self = shift;
Subroutine process: not called CC=17 SCAR=57.2
Pod undocumented
18 0 my ($input) = @_;
19  
20 0 ▶ my $options = $self->options or return;
Branch: 1 branch
BranchTrueFalseTotal
my $options = $self->options or return 0 0 0
21  
22 0 for my $o (keys %$options) {
23 0 ▶ next if $o eq 'args'; # Skip original arguments line
Branch: 1 branch
BranchTrueFalseTotal
if $o eq "args" 0 0 0
24 0 my $values = $self->value($input, $o);
25 0 ▶ next unless $values; # Skip input when no field found
Branch: 1 branch
BranchTrueFalseTotal
unless $values 0 0 0
26 0 my $filter = $options->{$o}; # Example: $filter = [ >=3 ]
27 0 $filter = $filter->[0]; # Example: $filter >= 3
28 0 for my $this (@$values) { # Example: $this = 3
29 0 ▶ if ($filter =~ m{((?:>|<|>=|<=|=))(\d+)$}) { # Example: $1 = >=, $2 = 3
Branch: 1 branch
BranchTrueFalseTotal
if ($filter =~ /((?:>|<|>=|<=|=))(\d+)$/) 0 0 0
30 0 ▶ if ($1 eq '>' ) { $self->output->add($input) if $this > $2 }
Branch: 6 branches
BranchTrueFalseTotal
if ($1 eq '>') { } 0 0 0
elsif ($1 eq '>=') { } 0 0 0
elsif ($1 eq '<') { } 0 0 0
elsif ($1 eq '<=') { } 0 0 0
elsif ($1 eq '=') { } 0 0 0
if $this > $2 0 0 0
31 0 ▶ elsif ($1 eq '>=') { $self->output->add($input) if $this >= $2 }
Branch: 1 branch
BranchTrueFalseTotal
if $this >= $2 0 0 0
32 0 ▶ elsif ($1 eq '<' ) { $self->output->add($input) if $this < $2 }
Branch: 1 branch
BranchTrueFalseTotal
if $this < $2 0 0 0
33 0 ▶ elsif ($1 eq '<=') { $self->output->add($input) if $this <= $2 }
Branch: 1 branch
BranchTrueFalseTotal
if $this <= $2 0 0 0
34 0 ▶ elsif ($1 eq '=' ) { $self->output->add($input) if $this == $2 }
Branch: 1 branch
BranchTrueFalseTotal
if $this == $2 0 0 0
35 }
36 }
37 }
38  
39 0 return 1;
40 }
41  
42 1 1;
43  
44 __END__
« blib/lib/Onyphe/Api.pm ↑ Summary blib/lib/OPP/Proc/Blocklist.pm »