File Coverage

blib/lib/Data/HTML/Form/Select/Option.pm
Criterion Covered Total %
statement 21 30 70.0
branch 0 4 0.0
condition n/a
subroutine 7 9 77.7
pod 0 1 0.0
total 28 44 63.6


line stmt bran cond sub pod time code
1              
2             use strict;
3 2     2   76856 use warnings;
  2         18  
  2         52  
4 2     2   10  
  2         3  
  2         60  
5             use Error::Pure qw(err);
6 2     2   789 use List::Util qw(none);
  2         20614  
  2         37  
7 2     2   137 use Mo qw(build is);
  2         4  
  2         225  
8 2     2   788 use Mo::utils qw(check_bool check_number);
  2         2301  
  2         10  
9 2     2   3340 use Readonly;
  2         2527  
  2         31  
10 2     2   159  
  2         5  
  2         545  
11             Readonly::Array our @DATA_TYPES => qw(plain tags);
12              
13             our $VERSION = 0.06;
14              
15             has css_class => (
16             is => 'ro',
17             );
18              
19             has data => (
20             default => [],
21             ro => 1,
22             );
23              
24             has data_type => (
25             ro => 1,
26             );
27              
28             has disabled => (
29             is => 'ro',
30             );
31              
32             has id => (
33             is => 'ro',
34             );
35              
36             has label => (
37             is => 'ro',
38             );
39              
40             has selected => (
41             is => 'ro',
42             );
43              
44             has value => (
45             is => 'ro',
46             );
47              
48             my $self = shift;
49              
50 0     0 0   # Check data type.
51             if (! defined $self->{'data_type'}) {
52             $self->{'data_type'} = 'plain';
53 0 0         }
54 0           if (none { $self->{'data_type'} eq $_ } @DATA_TYPES) {
55             err "Parameter 'data_type' has bad value.";
56 0 0   0     }
  0            
57 0            
58             # Check disabled.
59             check_bool($self, 'disabled');
60              
61 0           # Check selected.
62             check_bool($self, 'selected');
63              
64 0           return;
65             }
66 0            
67             1;
68