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
|
|
1693612
|
use strict; |
|
109
|
|
|
|
|
319
|
|
|
109
|
|
|
|
|
3476
|
|
6
|
109
|
|
|
109
|
|
624
|
use warnings; |
|
109
|
|
|
|
|
282
|
|
|
109
|
|
|
|
|
3439
|
|
7
|
|
|
|
|
|
|
|
8
|
109
|
|
|
109
|
|
632
|
use base 'Validation::Class::Directive'; |
|
109
|
|
|
|
|
274
|
|
|
109
|
|
|
|
|
51205
|
|
9
|
|
|
|
|
|
|
|
10
|
109
|
|
|
109
|
|
852
|
use Validation::Class::Util; |
|
109
|
|
|
|
|
370
|
|
|
109
|
|
|
|
|
492
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '7.900059'; # 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
|
1396
|
my ($self, $proto, $field, $param) = @_; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# set the field value |
59
|
|
|
|
|
|
|
|
60
|
560
|
|
100
|
|
|
1771
|
$field->{value} = $param || ''; |
61
|
|
|
|
|
|
|
|
62
|
560
|
|
|
|
|
1739
|
return $self; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub before_validation { |
67
|
|
|
|
|
|
|
|
68
|
560
|
|
|
560
|
0
|
1554
|
my ($self, $proto, $field, $param) = @_; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# set the field value |
71
|
|
|
|
|
|
|
|
72
|
560
|
|
100
|
|
|
1748
|
$field->{value} = $param || ''; |
73
|
|
|
|
|
|
|
|
74
|
560
|
|
|
|
|
1538
|
return $self; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub normalize { |
79
|
|
|
|
|
|
|
|
80
|
1009
|
|
|
1009
|
0
|
2574
|
my ($self, $proto, $field, $param) = @_; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# set the field value |
83
|
|
|
|
|
|
|
|
84
|
1009
|
|
100
|
|
|
3229
|
$field->{value} = $param || ''; |
85
|
|
|
|
|
|
|
|
86
|
1009
|
|
|
|
|
2825
|
return $self; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |