FormHandler/Widget/Field/ButtonTag.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 3 totaltotal 69.5% 32 / 46 CC 4 SCAR 7.4
CC
4
Cov
82%
render
3.2
render_element
2.0
html_element
2.0
CRAP 2.1
« FormHandler/Field/PasswordConf.pm ↑ Summary FormHandler/Field/Display.pm »
1 package HTML::FormHandler::Widget::Field::ButtonTag;
2 # ABSTRACT: button field rendering widget, using button tag
3 6 $HTML::FormHandler::Widget::Field::ButtonTag::VERSION = '0.410000';
4 6 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use HTML::FormHandler::Render::Util ('process_attrs');
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub html_element { 'button' }
Subroutine html_element: not called CC=1 SCAR=6.9
Pod undocumented
9  
10 sub render_element {
11 13 ▶ my ( $self, $result ) = @_;
Subroutine render_element: called CC=2 SCAR=7.1
Pod undocumented
12 13 ▶ $result ||= $self->result;
Condition33%1/3
$result ||= $self->result
l!l&&r!l&&!r
1300
MC/DC0%0/2
$result ||= $self->result
$result $self->result
Truth table33%1/3
A ||= B
A= $resultB= $self->result
ABresult
1X1
011
000
13  
14 13 my $output = '<button type="' . $self->input_type . '" name="'
15 . $self->html_name . '" id="' . $self->id . '"';
16 13 $output .= process_attrs($self->element_attributes($result));
17 13 $output .= '>';
18 13 $output .= $self->_localize($self->value);
19 13 $output .= "</button>";
20 13 return $output;
21 }
22  
23 sub render {
24 13 ▶ my ( $self, $result ) = @_;
Subroutine render: called CC=3 SCAR=11.8
Pod undocumented
25 13 ▶ $result ||= $self->result;
Condition33%1/3
$result ||= $self->result
l!l&&r!l&&!r
1300
MC/DC0%0/2
$result ||= $self->result
$result $self->result
Truth table33%1/3
A ||= B
A= $resultB= $self->result
ABresult
1X1
011
000
26 13 ▶ die "No result for form field '" . $self->full_name . "'. Field may be inactive." unless $result;
Branch: 1 branch
BranchTrueFalseTotal
unless $result 0 13 13
27 13 my $output = $self->render_element( $result );
28 13 return $self->wrap_field( $result, $output );
29 }
30  
31  
32 6 1;
33  
34 __END__
35  
36 =pod
37  
38 =encoding UTF-8
39  
40 =head1 NAME
41  
42 HTML::FormHandler::Widget::Field::ButtonTag - button field rendering widget, using button tag
43  
44 =head1 VERSION
45  
46 version 0.410000
47  
48 =head1 AUTHOR
49  
50 FormHandler Contributors - see HTML::FormHandler
51  
52 =head1 COPYRIGHT AND LICENSE
53  
54 This software is copyright (c) 2017 by Gerda Shank.
55  
56 This is free software; you can redistribute it and/or modify it under
57 the same terms as the Perl 5 programming language system itself.
58  
59 =cut
« FormHandler/Field/PasswordConf.pm ↑ Summary FormHandler/Field/Display.pm »