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