line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormFu::Constraint::AutoSet; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
814
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
144
|
|
4
|
|
|
|
|
|
|
our $VERSION = '2.05'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
14
|
use Moose; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
22
|
|
7
|
|
|
|
|
|
|
extends 'HTML::FormFu::Constraint::Set'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub process { |
10
|
7
|
|
|
7
|
0
|
11
|
my $self = shift; |
11
|
|
|
|
|
|
|
|
12
|
7
|
|
|
|
|
6
|
my @set = map { _parse_value($_) } @{ $self->parent->_options }; |
|
19
|
|
|
|
|
27
|
|
|
7
|
|
|
|
|
39
|
|
13
|
|
|
|
|
|
|
|
14
|
7
|
|
|
|
|
174
|
$self->set( \@set ); |
15
|
|
|
|
|
|
|
|
16
|
7
|
|
|
|
|
33
|
return $self->SUPER::process(@_); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _parse_value { |
20
|
23
|
|
|
23
|
|
20
|
my ($item) = @_; |
21
|
|
|
|
|
|
|
|
22
|
23
|
100
|
|
|
|
37
|
if ( exists $item->{group} ) { |
23
|
2
|
|
|
|
|
2
|
return map { _parse_value($_) } @{ $item->{group} }; |
|
4
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
3
|
|
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
else { |
26
|
|
|
|
|
|
|
# disabled attributes should be ignored |
27
|
21
|
50
|
33
|
|
|
58
|
return if ($item->{attributes} and $item->{attributes}->{disabled}); |
28
|
|
|
|
|
|
|
# anything else is fine |
29
|
21
|
|
|
|
|
41
|
return $item->{value}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
HTML::FormFu::Constraint::AutoSet - Set Constraint for Selects / Radiogroups / Checkboxgroups |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 VERSION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
version 2.05 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 DESCRIPTION |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
For use with L<HTML::FormFu::Element::Radiogroup>, |
50
|
|
|
|
|
|
|
L<HTML::FormFu::Element::Select> and L<HTML::FormFu::Element::Checkboxgroup> |
51
|
|
|
|
|
|
|
fields. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Ensures that the input value is one of the pre-defined element options. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 SEE ALSO |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Is a sub-class of, and inherits methods from L<HTML::FormFu::Constraint::Set> |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
L<HTML::FormFu> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 AUTHOR |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Carl Franks C<cfranks@cpan.org> |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 LICENSE |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
68
|
|
|
|
|
|
|
the same terms as Perl itself. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |