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