FormHandler/Widget/Form/Role/HTMLAttributes.pm

filter: Statementstmt 32.0% 8 / 25 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 2 / 3 Podpod 0.0% 0 / 1 totaltotal 25.0% 10 / 40 CC 7 SCAR 37.8
CC
7
Cov
24%
html_form_tag
56.0
BEGIN
1.0
BEGIN
1.0
CRAP 43.8
« FormHandler/Field/Upload.pm ↑ Summary FormHandler/Widget/Wrapper/SimpleInline.pm »
1 package HTML::FormHandler::Widget::Form::Role::HTMLAttributes;
2 # ABSTRACT: set HTML attributes on the form tag
3 147 $HTML::FormHandler::Widget::Form::Role::HTMLAttributes::VERSION = '0.410002';
4 147 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶sub html_form_tag {
Subroutine html_form_tag: not called CC=7 SCAR=40.3
Pod undocumented
7 0 my $self = shift;
8  
9 0 my @attr_accessors = (
10 [ action => 'action' ],
11 [ id => 'name' ],
12 [ method => 'http_method' ],
13 [ enctype => 'enctype' ],
14 [ style => 'style' ],
15 );
16  
17 # make the element_attr a safe default
18 0 my $element_attr = {};
19 # Assuming that self is a form
20 0 ▶ $element_attr = { %{$self->form_element_attr} } if ( $self->can( 'form_element_attr' ) );
Branch: 1 branch
BranchTrueFalseTotal
if $self->can("form_element_attr") 0 0 0
21 # Assuming that self is a field
22 0 ▶ $element_attr = { %{$self->element_attr} } if ( $self->can( 'element_attr' ) );
Branch: 1 branch
BranchTrueFalseTotal
if $self->can("element_attr") 0 0 0
23  
24 0 foreach my $attr_pair (@attr_accessors) {
25 0 my $attr = $attr_pair->[0];
26 0 my $accessor = $attr_pair->[1];
27 0 ▶ if ( !exists $element_attr->{$attr} && defined( my $value = $self->$accessor ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $element_attr->{$attr} and defined(my $value = $self->$accessor)) 0 0 0
Condition0%0/3
not exists $element_attr->{$attr} and defined(my $value = $self->$accessor)
!ll&&!rl&&r
000
MC/DC0%0/2
not exists $element_attr->{$attr} and defined(my $value = $self->$accessor)
not exists $element_attr->{$attr} defined(my $value = $self->$accessor)
Truth table0%0/3
not(A) and B
A= not exists $element_attr->{$attr}B= defined(my $value = $self->$accessor)
ABresult
0X0
100
111
28 0 $element_attr->{$attr} = $self->$accessor;
29 }
30 }
31  
32 0 my $output = '<form';
33 0 foreach my $attr ( sort keys %$element_attr ) {
34 0 $output .= qq{ $attr="} . $element_attr->{$attr} . qq{"};
35 }
36  
37 0 $output .= " >\n";
38 0 return $output;
39 }
40  
41 147 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 147 1;
43  
44 __END__
« FormHandler/Field/Upload.pm ↑ Summary FormHandler/Widget/Wrapper/SimpleInline.pm »