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/Field/Float.pm »
1 package HTML::FormHandler::Field::Result;
2 # ABSTRACT: result class for fields
3 148 $HTML::FormHandler::Field::Result::VERSION = '0.410001';
4 148 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 148 with 'HTML::FormHandler::Result::Role';
6  
7  
8 148 has 'value' => (
9 is => 'ro',
10 writer => '_set_value',
11 clearer => '_clear_value',
12 predicate => 'has_value',
13 );
14  
15 148 has 'field_def' => (
16 is => 'ro',
17 isa => 'HTML::FormHandler::Field',
18 writer => '_set_field_def',
19 );
20  
21 148 has 'missing' => ( is => 'rw', isa => 'Bool' );
22  
23 sub fif {
24 1364 ▶ my $self = shift;
Subroutine fif: called CC=1 SCAR=0.0
Pod undocumented
25 1364 return $self->field_def->fif($self);
26 }
27  
28 sub fields_fif {
29 69 ▶ my ( $self, $prefix ) = @_;
Subroutine fields_fif: called CC=1 SCAR=0.0
Pod undocumented
30 69 return $self->field_def->fields_fif( $self, $prefix );
31 }
32  
33 sub render {
34 292 ▶ my $self = shift;
Subroutine render: called CC=1 SCAR=0.0
Pod undocumented
35 292 return $self->field_def->render($self);
36 }
37  
38  
39 sub peek {
40 14 ▶ my ( $self, $indent ) = @_;
Subroutine peek: called CC=7 SCAR=19.7
Pod undocumented
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 148 __PACKAGE__->meta->make_immutable;
56 148 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
57 148 1;
58  
59 __END__
60  
61 =pod
62  
63 =encoding UTF-8
64  
65 =head1 NAME
66  
67 HTML::FormHandler::Field::Result - result class for fields
68  
69 =head1 VERSION
70  
71 version 0.410001
72  
73 =head1 SYNOPSIS
74  
75 Result class for L<HTML::FormHandler::Field>
76  
77 =head1 AUTHOR
78  
79 FormHandler Contributors - see HTML::FormHandler
80  
81 =head1 COPYRIGHT AND LICENSE
82  
83 This software is copyright (c) 2017 by Gerda Shank.
84  
85 This is free software; you can redistribute it and/or modify it under
86 the same terms as the Perl 5 programming language system itself.
87  
88 =cut
« FormHandler/Widget/Field/Repeatable.pm ↑ Summary FormHandler/Field/Float.pm »