FormHandler/Field/Result.pm

filter: Statementstmt 100% 30 / 30 Branchbran 75.0% 6 / 8 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 4 totaltotal 84.3% 43 / 51 CC 7 SCAR 15.2
CC
7
Cov
92%
peek
7.1
BEGIN
1.0
fif
1.0
CRAP 4.6
« FormHandler/Widget/Field/Repeatable.pm ↑ Summary FormHandler/Widget/Form/Table.pm »
1 package HTML::FormHandler::Field::Result;
2 # ABSTRACT: result class for fields
3 149 $HTML::FormHandler::Field::Result::VERSION = '0.410002';
4 149 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 149 with 'HTML::FormHandler::Result::Role';
6  
7  
8 149 has 'value' => (
9 is => 'ro',
10 writer => '_set_value',
11 clearer => '_clear_value',
12 predicate => 'has_value',
13 );
14  
15 149 has 'field_def' => (
16 is => 'ro',
17 isa => 'HTML::FormHandler::Field',
18 writer => '_set_field_def',
19 );
20  
21 149 has 'missing' => ( is => 'rw', isa => 'Bool' );
22  
23 1372 ▶sub fif {
Subroutine fif: called CC=1 SCAR=0.0
Pod undocumented
24 1372 my $self = shift;
25 1372 return $self->field_def->fif($self);
26 }
27  
28 69 ▶sub fields_fif {
Subroutine fields_fif: called CC=1 SCAR=0.0
Pod undocumented
29 69 my ( $self, $prefix ) = @_;
30 69 return $self->field_def->fields_fif( $self, $prefix );
31 }
32  
33 292 ▶sub render {
Subroutine render: called CC=1 SCAR=0.0
Pod undocumented
34 292 my $self = shift;
35 292 return $self->field_def->render($self);
36 }
37  
38  
39 14 ▶sub peek {
Subroutine peek: called CC=7 SCAR=19.7
Pod undocumented
40 14 my ( $self, $indent ) = @_;
41 14 ▶ $indent ||= '';
Condition50%1/2
$indent ||= ""
l!l
140
MC/DC0%0/1
$indent ||= ""
$indent
Truth table50%1/2
A
A= $indent
Aresult
11
00
42 14 ▶ my $name = $self->field_def ? $self->field_def->full_name : $self->name;
Branch: 1 branch
BranchTrueFalseTotal
$self->field_def ? : 14 0 14
43 14 ▶ my $type = $self->field_def ? $self->field_def->type : 'unknown';
Branch: 1 branch
BranchTrueFalseTotal
$self->field_def ? : 14 0 14
44 14 my $string = $indent . "result " . $name . " type: " . $type . "\n";
45 14 ▶ $string .= $indent . "....value => " . $self->value . "\n" if $self->has_value;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_value 7 7 14
46 14 ▶ if( $self->has_results ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_results) 4 10 14
47 4 $indent .= ' ';
48 4 foreach my $res ( $self->results ) {
49 8 $string .= $res->peek( $indent );
50 }
51 }
52 14 return $string;
53 }
54  
55 149 __PACKAGE__->meta->make_immutable;
56 149 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
57 149 1;
58  
59 __END__
« FormHandler/Widget/Field/Repeatable.pm ↑ Summary FormHandler/Widget/Form/Table.pm »