File Coverage

lib/HTML/FormWidgets/Rule.pm
Criterion Covered Total %
statement 26 31 83.8
branch 4 10 40.0
condition 1 3 33.3
subroutine 5 5 100.0
pod 2 2 100.0
total 38 51 74.5


line stmt bran cond sub pod time code
1             package HTML::FormWidgets::Rule;
2              
3 1     1   762 use strict;
  1         2  
  1         30  
4 1     1   5 use warnings;
  1         1  
  1         25  
5 1     1   4 use parent 'HTML::FormWidgets';
  1         2  
  1         5  
6              
7             __PACKAGE__->mk_accessors( qw( alt config href imgclass ) );
8              
9             sub init {
10 1     1 1 2    my ($self, $args) = @_;
11              
12 1         5    $self->alt ( undef );
13 1         7    $self->config ( {} );
14 1         10    $self->container( 0 );
15 1         8    $self->href ( undef );
16 1         7    $self->imgclass ( undef );
17 1         6    return;
18             }
19              
20             sub render_field {
21 1     1 1 2    my ($self, $args) = @_; my ($cells, $html); my $hacc = $self->hacc;
  1         1  
  1         4  
22              
23 1 50       5    if ($self->imgclass) {
24 0         0       $html = $hacc->hr ( { class => $self->class } );
25 0         0       $cells = $hacc->td ( { class => q(minimal rule_section) }, $html );
26 0 0       0       $html = $self->text
27                          ? $hacc->img ( { alt => $self->alt,
28                                           class => $self->imgclass,
29                                           src => $self->text } )
30                          : $hacc->span( { class => $self->imgclass } );
31                }
32 1         14    else { $html = $self->text }
33              
34 1 50       6    $self->href and $html = $self->inflate( { class => q(togglers),
35                                                          config => $self->config,
36                                                          container => 0,
37                                                          href => $self->href,
38                                                          id => $self->id,
39                                                          text => $html,
40                                                          type => q(anchor) } );
41              
42 1 50 33     8    if ($html and $self->tip) {
43 0         0       $html = $hacc->span( { class => q(tips), title => $self->tip }, $html );
44 0         0       $self->tip( undef );
45                }
46              
47 1 50       2    $html and $cells .= $hacc->td( { class => q(minimal) }, $html );
48 1         5    $cells .= $hacc->td( { class => q(most rule_section) },
49                                     $hacc->hr( { class => $self->class } ) );
50              
51 1         74    return $hacc->table( { class => q(rule) }, $hacc->tr( $cells ) );
52             }
53              
54             1;
55              
56             # Local Variables:
57             # mode: perl
58             # tab-width: 3
59             # End:
60              
61