line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Value Directive for Validation Class Field Definitions |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Validation::Class::Directive::Value; |
4
|
|
|
|
|
|
|
|
5
|
109
|
|
|
109
|
|
1389822
|
use strict; |
|
109
|
|
|
|
|
263
|
|
|
109
|
|
|
|
|
2925
|
|
6
|
109
|
|
|
109
|
|
514
|
use warnings; |
|
109
|
|
|
|
|
213
|
|
|
109
|
|
|
|
|
2934
|
|
7
|
|
|
|
|
|
|
|
8
|
109
|
|
|
109
|
|
512
|
use base 'Validation::Class::Directive'; |
|
109
|
|
|
|
|
201
|
|
|
109
|
|
|
|
|
41205
|
|
9
|
|
|
|
|
|
|
|
10
|
109
|
|
|
109
|
|
753
|
use Validation::Class::Util; |
|
109
|
|
|
|
|
199
|
|
|
109
|
|
|
|
|
395
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '7.900058'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'mixin' => 1; |
16
|
|
|
|
|
|
|
has 'field' => 1; |
17
|
|
|
|
|
|
|
has 'multi' => 1; |
18
|
|
|
|
|
|
|
# ensure most core directives execute before this one |
19
|
|
|
|
|
|
|
has 'dependencies' => sub {{ |
20
|
|
|
|
|
|
|
normalization => [qw( |
21
|
|
|
|
|
|
|
default |
22
|
|
|
|
|
|
|
)], |
23
|
|
|
|
|
|
|
validation => [qw( |
24
|
|
|
|
|
|
|
alias |
25
|
|
|
|
|
|
|
between |
26
|
|
|
|
|
|
|
depends_on |
27
|
|
|
|
|
|
|
error |
28
|
|
|
|
|
|
|
errors |
29
|
|
|
|
|
|
|
filtering |
30
|
|
|
|
|
|
|
filters |
31
|
|
|
|
|
|
|
label |
32
|
|
|
|
|
|
|
length |
33
|
|
|
|
|
|
|
matches |
34
|
|
|
|
|
|
|
max_alpha |
35
|
|
|
|
|
|
|
max_digits |
36
|
|
|
|
|
|
|
max_length |
37
|
|
|
|
|
|
|
max_sum |
38
|
|
|
|
|
|
|
min_alpha |
39
|
|
|
|
|
|
|
min_digits |
40
|
|
|
|
|
|
|
min_length |
41
|
|
|
|
|
|
|
min_sum |
42
|
|
|
|
|
|
|
mixin |
43
|
|
|
|
|
|
|
mixin_field |
44
|
|
|
|
|
|
|
multiples |
45
|
|
|
|
|
|
|
name |
46
|
|
|
|
|
|
|
options |
47
|
|
|
|
|
|
|
pattern |
48
|
|
|
|
|
|
|
readonly |
49
|
|
|
|
|
|
|
required |
50
|
|
|
|
|
|
|
toggle |
51
|
|
|
|
|
|
|
)] |
52
|
|
|
|
|
|
|
}}; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub after_validation { |
55
|
|
|
|
|
|
|
|
56
|
560
|
|
|
560
|
0
|
1231
|
my ($self, $proto, $field, $param) = @_; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# set the field value |
59
|
|
|
|
|
|
|
|
60
|
560
|
|
100
|
|
|
1549
|
$field->{value} = $param || ''; |
61
|
|
|
|
|
|
|
|
62
|
560
|
|
|
|
|
1711
|
return $self; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub before_validation { |
67
|
|
|
|
|
|
|
|
68
|
560
|
|
|
560
|
0
|
1276
|
my ($self, $proto, $field, $param) = @_; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# set the field value |
71
|
|
|
|
|
|
|
|
72
|
560
|
|
100
|
|
|
1627
|
$field->{value} = $param || ''; |
73
|
|
|
|
|
|
|
|
74
|
560
|
|
|
|
|
1350
|
return $self; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub normalize { |
79
|
|
|
|
|
|
|
|
80
|
1009
|
|
|
1009
|
0
|
2151
|
my ($self, $proto, $field, $param) = @_; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# set the field value |
83
|
|
|
|
|
|
|
|
84
|
1009
|
|
100
|
|
|
2972
|
$field->{value} = $param || ''; |
85
|
|
|
|
|
|
|
|
86
|
1009
|
|
|
|
|
2338
|
return $self; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |