FormHandler/Widget/Field/Hidden.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 74.4% 35 / 47 CC 5 SCAR 10.2
CC
5
Cov
83%
render
4.5
render_element
2.0
BEGIN
1.0
CRAP 2.8
« FormHandler/Widget/Field/Text.pm ↑ Summary FormHandler/Field/AddElement.pm »
1 package HTML::FormHandler::Widget::Field::Hidden;
2 # ABSTRACT: hidden field rendering widget
3 21 $HTML::FormHandler::Widget::Field::Hidden::VERSION = '0.410001';
4 21 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 21 ▶use HTML::FormHandler::Render::Util ('process_attrs');
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 sub render_element {
9 22 ▶ my ( $self, $result ) = @_;
Subroutine render_element: called CC=2 SCAR=7.0
Pod undocumented
10 22 ▶ $result ||= $self->result;
Condition33%1/3
$result ||= $self->result
l!l&&r!l&&!r
2200
MC/DC0%0/2
$result ||= $self->result
$result $self->result
Truth table33%1/3
A ||= B
A= $resultB= $self->result
ABresult
1X1
011
000
11  
12 22 my $output = '<input type="hidden" name="';
13 22 $output .= $self->html_name . '"';
14 22 $output .= ' id="' . $self->id . '"';
15 22 $output .= ' value="' . $self->html_filter($result->fif) . '"';
16 22 $output .= process_attrs($self->element_attributes($result));
17 22 $output .= " />";
18  
19 22 return $output;
20 }
21  
22 sub render {
23 21 ▶ my ( $self, $result ) = @_;
Subroutine render: called CC=4 SCAR=15.0
Pod undocumented
24 21 ▶ $result ||= $self->result;
Condition66%2/3
$result ||= $self->result
l!l&&r!l&&!r
1740
MC/DC0%0/2
$result ||= $self->result
$result $self->result
Truth table66%2/3
A ||= B
A= $resultB= $self->result
ABresult
1X1
011
000
25 21 ▶ die "No result for form field '" . $self->full_name . "'. Field may be inactive." unless $result;
Branch: 1 branch
BranchTrueFalseTotal
unless $result 0 21 21
26 21 my $output = $self->render_element( $result );
27 # wrap field unless do_label is set, which would cause unwanted
28 # labels to be displayed
29 21 ▶ return $self->wrap_field( $result, $output ) if !$self->do_label;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->do_label 21 0 21
30 0 return $output;
31 }
32  
33  
34 21 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 21 1;
36  
37 __END__
38  
39 =pod
40  
41 =encoding UTF-8
42  
43 =head1 NAME
44  
45 HTML::FormHandler::Widget::Field::Hidden - hidden field rendering widget
46  
47 =head1 VERSION
48  
49 version 0.410001
50  
51 =head1 SYNOPSIS
52  
53 Widget for rendering a hidden field.
54  
55 =head1 AUTHOR
56  
57 FormHandler Contributors - see HTML::FormHandler
58  
59 =head1 COPYRIGHT AND LICENSE
60  
61 This software is copyright (c) 2017 by Gerda Shank.
62  
63 This is free software; you can redistribute it and/or modify it under
64 the same terms as the Perl 5 programming language system itself.
65  
66 =cut
« FormHandler/Widget/Field/Text.pm ↑ Summary FormHandler/Field/AddElement.pm »