File Coverage

blib/lib/HTML/FormHandler/Widget/Wrapper/Table.pm
Criterion Covered Total %
statement 22 22 100.0
branch 9 10 90.0
condition 4 6 66.6
subroutine 4 4 100.0
pod 0 1 0.0
total 39 43 90.7


line stmt bran cond sub pod time code
1             package HTML::FormHandler::Widget::Wrapper::Table;
2             # ABSTRACT: wrapper class for table layout
3             $HTML::FormHandler::Widget::Wrapper::Table::VERSION = '0.40068';
4 2     2   1612 use Moose::Role;
  2         6  
  2         19  
5             with 'HTML::FormHandler::Widget::Wrapper::Base';
6 2     2   10798 use HTML::FormHandler::Render::Util ('process_attrs');
  2         6  
  2         17  
7              
8             sub wrap_field {
9 39     39 0 104 my ( $self, $result, $rendered_widget ) = @_;
10              
11 39 50 66     143 return $rendered_widget if ( $self->has_flag('is_compound') && $self->get_tag('no_compound_wrapper') );
12              
13 39         173 my $output = "\n<tr" . process_attrs($self->wrapper_attributes($result)) . ">";
14 39 100 66     148 if ( $self->has_flag('is_compound') ) {
    100          
15 4         22 $output .= '<td>' . $self->do_render_label($result) . '</td></tr>';
16             }
17             elsif ( $self->do_label && length( $self->label ) > 0 ) {
18 29         149 $output .= '<td>' . $self->do_render_label($result) . '</td>';
19             }
20 39 100       154 if ( !$self->has_flag('is_compound') ) {
21 35         78 $output .= '<td>';
22             }
23 39         95 $output .= $rendered_widget;
24 39         1292 $output .= qq{\n<span class="error_message">$_</span>} for $result->all_errors;
25 39 100       115 if ( !$self->has_flag('is_compound') ) {
26 35         98 $output .= "</td></tr>\n";
27             }
28 39         243 return $output;
29             }
30              
31 2     2   803 use namespace::autoclean;
  2         5  
  2         18  
32             1;
33              
34             __END__
35              
36             =pod
37              
38             =encoding UTF-8
39              
40             =head1 NAME
41              
42             HTML::FormHandler::Widget::Wrapper::Table - wrapper class for table layout
43              
44             =head1 VERSION
45              
46             version 0.40068
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