| 1 | package Data::HTML::Element::Select; | ||
| 2 | |||
| 3 | 16 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 16 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 0 | ▶ | use Data::HTML::Element::Utils qw(check_data check_data_type); |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 7 | use Mo qw(build default is); | ||
| 8 | use Mo::utils 0.26 qw(check_bool check_number); | ||
| 9 | use Mo::utils::CSS 0.02 qw(check_css_class); | ||
| 10 | |||
| 11 | our $VERSION = 0.17; | ||
| 12 | |||
| 13 | has autofocus => ( | ||
| 14 | is => 'ro', | ||
| 15 | ); | ||
| 16 | |||
| 17 | has css_class => ( | ||
| 18 | is => 'ro', | ||
| 19 | ); | ||
| 20 | |||
| 21 | has data => ( | ||
| 22 | default => [], | ||
| 23 | ro => 1, | ||
| 24 | ); | ||
| 25 | |||
| 26 | has data_type => ( | ||
| 27 | ro => 1, | ||
| 28 | ); | ||
| 29 | |||
| 30 | has disabled => ( | ||
| 31 | is => 'ro', | ||
| 32 | ); | ||
| 33 | |||
| 34 | has form => ( | ||
| 35 | is => 'ro', | ||
| 36 | ); | ||
| 37 | |||
| 38 | has id => ( | ||
| 39 | is => 'ro', | ||
| 40 | ); | ||
| 41 | |||
| 42 | has label => ( | ||
| 43 | is => 'ro', | ||
| 44 | ); | ||
| 45 | |||
| 46 | has multiple => ( | ||
| 47 | is => 'ro', | ||
| 48 | ); | ||
| 49 | |||
| 50 | has name => ( | ||
| 51 | is => 'ro', | ||
| 52 | ); | ||
| 53 | |||
| 54 | has onchange => ( | ||
| 55 | is => 'ro', | ||
| 56 | ); | ||
| 57 | |||
| 58 | has required => ( | ||
| 59 | is => 'ro', | ||
| 60 | ); | ||
| 61 | |||
| 62 | has size => ( | ||
| 63 | is => 'ro', | ||
| 64 | ); | ||
| 65 | |||
| 66 | sub BUILD { | ||
| 67 | my $self = shift; | ||
| 68 | |||
| 69 | # Check autofocus. | ||
| 70 | if (! defined $self->{'autofocus'}) { | ||
| 71 | $self->{'autofocus'} = 0; | ||
| 72 | } | ||
| 73 | check_bool($self, 'autofocus'); | ||
| 74 | |||
| 75 | # Check CSS class. | ||
| 76 | check_css_class($self, 'css_class'); | ||
| 77 | |||
| 78 | # Check data type. | ||
| 79 | check_data_type($self); | ||
| 80 | |||
| 81 | # Check data based on type. | ||
| 82 | check_data($self); | ||
| 83 | |||
| 84 | # Check disabled. | ||
| 85 | if (! defined $self->{'disabled'}) { | ||
| 86 | $self->{'disabled'} = 0; | ||
| 87 | } | ||
| 88 | check_bool($self, 'disabled'); | ||
| 89 | |||
| 90 | # Check multiple. | ||
| 91 | if (! defined $self->{'multiple'}) { | ||
| 92 | $self->{'multiple'} = 0; | ||
| 93 | } | ||
| 94 | check_bool($self, 'multiple'); | ||
| 95 | |||
| 96 | # Check required. | ||
| 97 | if (! defined $self->{'required'}) { | ||
| 98 | $self->{'required'} = 0; | ||
| 99 | } | ||
| 100 | check_bool($self, 'required'); | ||
| 101 | |||
| 102 | # Check size. | ||
| 103 | check_number($self, 'size'); | ||
| 104 | |||
| 105 | return; | ||
| 106 | } | ||
| 107 | |||
| 108 | 1; | ||
| 109 | |||
| 110 | __END__ | ||