line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Form::Processor::Field::Multiple; |
2
|
|
|
|
|
|
|
$Form::Processor::Field::Multiple::VERSION = '1.162360'; |
3
|
1
|
|
|
1
|
|
833
|
use strict; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
3
|
use base 'Form::Processor::Field::Select'; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
365
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
0
|
10
|
sub init_multiple {1} # allow multiple values. |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
0
|
0
|
0
|
sub init_size {5} # default to showing five items if showing in a select list. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub options { |
16
|
5
|
|
|
5
|
1
|
34
|
my $self = shift; |
17
|
5
|
|
|
|
|
13
|
my @options = $self->SUPER::options( @_ ); |
18
|
5
|
|
|
|
|
38
|
my $value = $self->value; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# This places the currently selected options at the top of the list |
22
|
|
|
|
|
|
|
# Makes the drop down lists a bit nicer |
23
|
|
|
|
|
|
|
|
24
|
5
|
50
|
33
|
|
|
21
|
if ( @options && defined $value ) { |
25
|
0
|
0
|
|
|
|
0
|
my %selected = map { $_ => 1 } ref( $value ) eq 'ARRAY' ? @$value : ( $value ); |
|
0
|
|
|
|
|
0
|
|
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
0
|
my @out = grep { $selected{ $_->{value} } } @options; |
|
0
|
|
|
|
|
0
|
|
28
|
0
|
|
|
|
|
0
|
push @out, grep { !$selected{ $_->{value} } } @options; |
|
0
|
|
|
|
|
0
|
|
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
0
|
return wantarray ? @out : \@out; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
5
|
100
|
|
|
|
12
|
return wantarray ? @options : \@options; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# ABSTRACT: Select one or more options |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |