| 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
|
108
|
|
|
108
|
|
69798
|
use strict; |
|
|
108
|
|
|
|
|
215
|
|
|
|
108
|
|
|
|
|
2932
|
|
|
6
|
108
|
|
|
108
|
|
554
|
use warnings; |
|
|
108
|
|
|
|
|
203
|
|
|
|
108
|
|
|
|
|
2933
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
108
|
|
|
108
|
|
520
|
use base 'Validation::Class::Directive'; |
|
|
108
|
|
|
|
|
187
|
|
|
|
108
|
|
|
|
|
8721
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
108
|
|
|
108
|
|
619
|
use Validation::Class::Util; |
|
|
108
|
|
|
|
|
216
|
|
|
|
108
|
|
|
|
|
724
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '7.900057'; # 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
|
555
|
|
|
555
|
0
|
1105
|
my ($self, $proto, $field, $param) = @_; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# set the field value |
|
59
|
|
|
|
|
|
|
|
|
60
|
555
|
|
100
|
|
|
1879
|
$field->{value} = $param || ''; |
|
61
|
|
|
|
|
|
|
|
|
62
|
555
|
|
|
|
|
2167
|
return $self; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub before_validation { |
|
67
|
|
|
|
|
|
|
|
|
68
|
555
|
|
|
555
|
0
|
1485
|
my ($self, $proto, $field, $param) = @_; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# set the field value |
|
71
|
|
|
|
|
|
|
|
|
72
|
555
|
|
100
|
|
|
1828
|
$field->{value} = $param || ''; |
|
73
|
|
|
|
|
|
|
|
|
74
|
555
|
|
|
|
|
1804
|
return $self; |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub normalize { |
|
79
|
|
|
|
|
|
|
|
|
80
|
1002
|
|
|
1002
|
0
|
1839
|
my ($self, $proto, $field, $param) = @_; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# set the field value |
|
83
|
|
|
|
|
|
|
|
|
84
|
1002
|
|
100
|
|
|
3527
|
$field->{value} = $param || ''; |
|
85
|
|
|
|
|
|
|
|
|
86
|
1002
|
|
|
|
|
3632
|
return $self; |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |