line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Shakan::Field::Choice; |
2
|
22
|
|
|
22
|
|
112
|
use strict; |
|
22
|
|
|
|
|
40
|
|
|
22
|
|
|
|
|
647
|
|
3
|
22
|
|
|
22
|
|
102
|
use warnings; |
|
22
|
|
|
|
|
36
|
|
|
22
|
|
|
|
|
558
|
|
4
|
|
|
|
|
|
|
|
5
|
22
|
|
|
22
|
|
105
|
use List::Util qw/pairmap/; |
|
22
|
|
|
|
|
38
|
|
|
22
|
|
|
|
|
2400
|
|
6
|
|
|
|
|
|
|
|
7
|
22
|
|
|
22
|
|
117
|
use Mouse; |
|
22
|
|
|
|
|
35
|
|
|
22
|
|
|
|
|
143
|
|
8
|
|
|
|
|
|
|
extends 'HTML::Shakan::Field'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has '+widget' => ( |
11
|
|
|
|
|
|
|
default => 'select' |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has choices => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => 'ArrayRef', |
17
|
|
|
|
|
|
|
required => 1, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'id_tmpl' => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => 'Str', |
23
|
|
|
|
|
|
|
default => 'id_%s_%s', |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
override 'get_constraints' => sub { |
27
|
|
|
|
|
|
|
my $self = shift; |
28
|
|
|
|
|
|
|
my ($name, $constraints) = super(); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
return ( |
31
|
|
|
|
|
|
|
$name => [ |
32
|
|
|
|
|
|
|
@$constraints, |
33
|
|
|
|
|
|
|
['CHOICE' => [ pairmap { $a } @{$self->choices} ] ] |
34
|
|
|
|
|
|
|
] |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
|
38
|
22
|
|
|
22
|
|
10159
|
no Mouse; |
|
22
|
|
|
|
|
53
|
|
|
22
|
|
|
|
|
114
|
|
39
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
40
|
|
|
|
|
|
|
__END__ |