| 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.410002'; | |||||||||||||||||||
| 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 | 2 | ▶ | use HTML::Entities qw( encode_entities ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 4 | ▶ | sub render_start { | ||||||||||||||||||
|
Subroutine
render_start: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||
| 12 | 4 | my ( $self, $result ) = @_; | |||||||||||||||||||
| 13 | 4 | ▶ | $result ||= $self->result; | ||||||||||||||||||
|
Condition33%1/3
$result ||= $self->result
MC/DC0%0/2
$result ||= $self->result
$result
$self->result
Truth table33%1/3
A ||= B
A= $resultB= $self->result
| |||||||||||||||||||||
| 14 | 4 | my $fattrs = process_attrs($self->attributes($result)); | |||||||||||||||||||
| 15 | 4 | my $wattrs = process_attrs($self->form_wrapper_attributes($result)); | |||||||||||||||||||
| 16 | 4 | return qq{<form$fattrs><table$wattrs>\n}; | |||||||||||||||||||
| 17 | } | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 0 | ▶ | sub render_form_errors { | ||||||||||||||||||
|
Subroutine
render_form_errors: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 20 | 0 | my ( $self, $result ) = @_; | |||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | ▶ | return '' unless $result->has_form_errors; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 23 | 0 | my $output = "\n<tr class=\"form_errors\"><td colspan=\"2\">"; | |||||||||||||||||||
| 24 | $output .= qq{\n<span class="error_message">$_</span>} | ||||||||||||||||||||
| 25 | 0 | for map { encode_entities($_) } $result->all_form_errors; | |||||||||||||||||||
| 26 | 0 | $output .= "\n</td></tr>"; | |||||||||||||||||||
| 27 | 0 | return $output; | |||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 4 | ▶ | sub render_end { | ||||||||||||||||||
|
Subroutine
render_end: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 31 | 4 | my $self = shift; | |||||||||||||||||||
| 32 | 4 | my $output = "</table>\n"; | |||||||||||||||||||
| 33 | 4 | $output .= "</form>\n"; | |||||||||||||||||||
| 34 | 4 | return $output; | |||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 2 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 38 | 2 | 1; | |||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | __END__ | ||||||||||||||||||||