line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: ** Please provide abstract ** |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Form::Processor::Field::Select; |
4
|
|
|
|
|
|
|
$Form::Processor::Field::Select::VERSION = '1.162360'; |
5
|
15
|
|
|
15
|
|
978
|
use strict; |
|
15
|
|
|
|
|
16
|
|
|
15
|
|
|
|
|
345
|
|
6
|
15
|
|
|
15
|
|
43
|
use warnings; |
|
15
|
|
|
|
|
16
|
|
|
15
|
|
|
|
|
293
|
|
7
|
15
|
|
|
15
|
|
45
|
use base 'Form::Processor::Field'; |
|
15
|
|
|
|
|
12
|
|
|
15
|
|
|
|
|
5995
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Rose::Object::MakeMethods::Generic ( |
12
|
15
|
|
|
|
|
130
|
array => [ |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Array of hashes with value and label. |
15
|
|
|
|
|
|
|
options => { interface => 'get_set_init' }, |
16
|
|
|
|
|
|
|
reset_options => { interface => 'reset', hash_key => 'options' }, |
17
|
|
|
|
|
|
|
], |
18
|
|
|
|
|
|
|
scalar => [ |
19
|
|
|
|
|
|
|
multiple => { interface => 'get_set_init' }, |
20
|
|
|
|
|
|
|
size => { interface => 'get_set_init' }, |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
label_column => { interface => 'get_set_init' }, |
23
|
|
|
|
|
|
|
active_column => { interface => 'get_set_init' }, |
24
|
|
|
|
|
|
|
auto_widget_size => { interface => 'get_set_init' }, |
25
|
|
|
|
|
|
|
sort_order => {}, |
26
|
|
|
|
|
|
|
], |
27
|
15
|
|
|
15
|
|
165
|
); |
|
15
|
|
|
|
|
18
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
1
|
0
|
8
|
sub init_options { [] } |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
0
|
1
|
0
|
sub init_widget {'select'} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
1
|
0
|
9
|
sub init_multiple {0} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
0
|
0
|
|
sub init_auto_widget_size {0} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub select_widget { |
42
|
0
|
|
|
0
|
1
|
|
my $field = shift; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $size = $field->auto_widget_size; |
45
|
|
|
|
|
|
|
|
46
|
0
|
0
|
0
|
|
|
|
return $field->widget unless $field->widget eq 'select' && $size; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
0
|
|
|
|
my $options = $field->options || []; |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
return 'select' if @$options > $size; |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
return $field->multiple ? 'checkbox' : 'radio'; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
0
|
0
|
|
sub init_size {0} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
0
|
0
|
|
sub init_label_column {'name'} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
0
|
|
sub init_active_column {'active'} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub as_label { |
75
|
0
|
|
|
0
|
1
|
|
my $field = shift; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
my $value = $field->value; |
78
|
0
|
0
|
|
|
|
|
return unless defined $value; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
for ( $field->options ) { |
81
|
0
|
0
|
|
|
|
|
return $_->{label} if $_->{value} eq $value; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
return; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |