FormHandler/Widget/Form/Table.pm

filter: Statementstmt 77.7% 21 / 27 Branchbran 0.0% 0 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 3 totaltotal 62.7% 27 / 43 CC 4 SCAR 15.9
CC
4
Cov
69%
render_form_errors
12.0
render_start
2.1
BEGIN
1.0
CRAP 4.9
« FormHandler/Field/IntRange.pm ↑ Summary FormHandler/Field/RequestToken.pm »
1 package HTML::FormHandler::Widget::Form::Table;
2 # ABSTRACT: render a form with a table layout
3 2 $HTML::FormHandler::Widget::Form::Table::VERSION = '0.410000';
4 2 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 with 'HTML::FormHandler::Widget::Form::Simple' =>
6 { -excludes => [ 'render_start', 'render_end', 'render_form_errors' ] };
7 2 ▶use HTML::FormHandler::Render::Util ('process_attrs');
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 sub render_start {
11 4 ▶ my ( $self, $result ) = @_;
Subroutine render_start: called CC=2 SCAR=7.2
Pod undocumented
12 4 ▶ $result ||= $self->result;
Condition33%1/3
$result ||= $self->result
l!l&&r!l&&!r
400
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 4 my $fattrs = process_attrs($self->attributes($result));
14 4 my $wattrs = process_attrs($self->form_wrapper_attributes($result));
15 4 return qq{<form$fattrs><table$wattrs>\n};
16 }
17  
18 sub render_form_errors {
19 0 ▶ my ( $self, $result ) = @_;
Subroutine render_form_errors: not called CC=3 SCAR=24.8
Pod undocumented
20  
21 0 ▶ return '' unless $result->has_form_errors;
Branch: 1 branch
BranchTrueFalseTotal
unless $result->has_form_errors 0 0 0
22 0 my $output = "\n<tr class=\"form_errors\"><td colspan=\"2\">";
23 $output .= qq{\n<span class="error_message">$_</span>}
24 0 for $result->all_form_errors;
25 0 $output .= "\n</td></tr>";
26 0 return $output;
27 }
28  
29 sub render_end {
30 4 ▶ my $self = shift;
Subroutine render_end: called CC=1 SCAR=0.0
Pod undocumented
31 4 my $output = "</table>\n";
32 4 $output .= "</form>\n";
33 4 return $output;
34 }
35  
36 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 2 1;
38  
39 __END__
40  
41 =pod
42  
43 =encoding UTF-8
44  
45 =head1 NAME
46  
47 HTML::FormHandler::Widget::Form::Table - render a form with a table layout
48  
49 =head1 VERSION
50  
51 version 0.410000
52  
53 =head1 SYNOPSIS
54  
55 Set in your form:
56  
57 has '+widget_form' => ( default => 'Table' );
58  
59 Use in a template:
60  
61 [% form.render %]
62  
63 =head1 AUTHOR
64  
65 FormHandler Contributors - see HTML::FormHandler
66  
67 =head1 COPYRIGHT AND LICENSE
68  
69 This software is copyright (c) 2017 by Gerda Shank.
70  
71 This is free software; you can redistribute it and/or modify it under
72 the same terms as the Perl 5 programming language system itself.
73  
74 =cut
« FormHandler/Field/IntRange.pm ↑ Summary FormHandler/Field/RequestToken.pm »