lib/HTML/FormFu/Filter/CopyValue.pm

filter: Statementstmt 100% 21 / 21 Branchbran 50.0% 3 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 78.3% 29 / 37 CC 5 SCAR 14.1
CC
5
Cov
83%
filter
5.9
BEGIN
1.0
BEGIN
1.0
CRAP 4.1
« lib/HTML/FormFu/Validator.pm ↑ Summary lib/HTML/FormFu/Processor.pm »
1 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package HTML::FormFu::Filter::CopyValue;
4 4 $HTML::FormFu::Filter::CopyValue::VERSION = '2.09';
5 # ABSTRACT: copy the value from another field
6  
7 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use MooseX::Attribute::Chained;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 extends 'HTML::FormFu::Filter';
10  
11 4 with 'HTML::FormFu::Role::NestedHashUtils';
12  
13 4 has field => ( is => 'rw', traits => ['Chained'] );
14  
15 1 ▶sub filter {
Subroutine filter: called CC=5 SCAR=17.8
Pod undocumented
16 1 my ( $self, $value ) = @_;
17  
18 1 ▶ return $value
Branch: 1 branch
BranchTrueFalseTotal
if defined $value and length $value 0 1 1
Condition33%1/3
defined $value and length $value
!ll&&!rl&&r
100
MC/DC0%0/2
defined $value and length $value
defined $value length $value
Truth table33%1/3
A and B
A= defined $valueB= length $value
ABresult
0X0
100
111
19 if ( defined $value && length $value );
20  
21 1 ▶ my $field_name = $self->field
Branch: 1 branch
BranchTrueFalseTotal
my $field_name = $self->field or die "Parameter 'field' is not defined." 1 0 1
22 or die "Parameter 'field' is not defined.";
23  
24 1 ▶ my $parent = $self->parent
Branch: 1 branch
BranchTrueFalseTotal
my $parent = $self->parent or die "Can't determine my parent." 1 0 1
25 or die "Can't determine my parent.";
26  
27 1 my $field_value
28 = $self->get_nested_hash_value( $parent->form->input, $field_name, );
29  
30 1 return $field_value;
31 }
32  
33 4 __PACKAGE__->meta->make_immutable;
34  
35 4 1;
36  
37 __END__
« lib/HTML/FormFu/Validator.pm ↑ Summary lib/HTML/FormFu/Processor.pm »