blib/lib/OPP/Proc/Fieldcount.pm

filter: Statementstmt 54.5% 12 / 22 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 46.8% 15 / 32 CC 3 SCAR 18.7
CC
3
Cov
46%
process
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.5
« blib/lib/OPP/Proc/Expand.pm ↑ Summary blib/lib/OPP/Proc/Top.pm »
1 #
2 # $Id: Fieldcount.pm,v cd68184c46bd 2023/03/23 09:32:23 gomor $
3 #
4 package OPP::Proc::Fieldcount;
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
15 #
16 sub process {
17 0 ▶ my $self = shift;
Subroutine process: not called CC=3 SCAR=24.8
Pod undocumented
18 0 my ($input) = @_;
19  
20 0 ▶ my $field = $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 0 my $values = $self->value($input, $field);
23 0 ▶ return 1 unless defined($values); # No field in doc, skip it
Branch: 1 branch
BranchTrueFalseTotal
unless defined $values 0 0 0
24  
25 0 my $new_fieldname = $field.'count';
26 0 $new_fieldname =~ s{\.}{}g;
27
28 # Update document with count field:
29 0 $input->{$new_fieldname} = @$values;
30  
31 0 $self->output->add($input);
32  
33 0 return 1;
34 }
35  
36 1 1;
37  
38 __END__
« blib/lib/OPP/Proc/Expand.pm ↑ Summary blib/lib/OPP/Proc/Top.pm »