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   81462 use warnings;
  2         24  
  2         60  
4 2     2   13  
  2         4  
  2         76  
5             use Error::Pure qw(err);
6 2     2   894 use List::Util qw(none);
  2         23910  
  2         45  
7 2     2   179 use Mo qw(build is);
  2         8  
  2         265  
8 2     2   941 use Mo::utils qw(check_bool check_number);
  2         2623  
  2         12  
9 2     2   3888 use Readonly;
  2         2923  
  2         35  
10 2     2   203  
  2         4  
  2         569  
11             Readonly::Array our @DATA_TYPES => qw(plain tags);
12              
13             our $VERSION = 0.05;
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