line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
2212
|
use strict; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
277
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::FormFu::Constraint::Set; |
4
|
|
|
|
|
|
|
$HTML::FormFu::Constraint::Set::VERSION = '2.07'; |
5
|
|
|
|
|
|
|
# ABSTRACT: Set of Values Constraint |
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
31
|
use Moose; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
33
|
|
8
|
5
|
|
|
5
|
|
33035
|
use MooseX::Attribute::Chained; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
180
|
|
9
|
|
|
|
|
|
|
extends 'HTML::FormFu::Constraint'; |
10
|
|
|
|
|
|
|
|
11
|
5
|
|
|
5
|
|
31
|
use Clone (); |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
1116
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has set => ( is => 'rw', traits => ['Chained'] ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub constrain_value { |
16
|
13
|
|
|
13
|
0
|
42
|
my ( $self, $value ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
13
|
100
|
66
|
|
|
64
|
return 1 if !defined $value || $value eq ''; |
19
|
|
|
|
|
|
|
|
20
|
11
|
|
|
|
|
322
|
my $set = $self->set; |
21
|
|
|
|
|
|
|
|
22
|
11
|
|
|
|
|
171
|
my %set = map { $_ => 1 } @$set; |
|
27
|
|
|
|
|
89
|
|
23
|
|
|
|
|
|
|
|
24
|
11
|
|
|
|
|
58
|
return exists $set{$value}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub clone { |
28
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $clone = $self->SUPER::clone(@_); |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
|
if ( $self->set ) { |
33
|
0
|
|
|
|
|
|
$clone->set( Clone::clone( $self->set ) ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
return $clone; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=pod |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=encoding UTF-8 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
HTML::FormFu::Constraint::Set - Set of Values Constraint |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 VERSION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
version 2.07 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SYNOPSIS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
type: Set |
60
|
|
|
|
|
|
|
set: [yes, no] |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 DESCRIPTION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
The input value must be in the specified set of values. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 METHODS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 set |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Arguments: \@allowed_values |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 SEE ALSO |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Is a sub-class of, and inherits methods from L<HTML::FormFu::Constraint> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
L<HTML::FormFu> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHOR |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Carl Franks C<cfranks@cpan.org> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 LICENSE |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
85
|
|
|
|
|
|
|
the same terms as Perl itself. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 AUTHOR |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Carl Franks <cpan@fireartist.com> |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Carl Franks. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
96
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |