line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: MinLength Directive for Validation Class Field Definitions |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Validation::Class::Directive::MinLength; |
4
|
|
|
|
|
|
|
|
5
|
108
|
|
|
108
|
|
68652
|
use strict; |
|
108
|
|
|
|
|
217
|
|
|
108
|
|
|
|
|
2831
|
|
6
|
108
|
|
|
108
|
|
543
|
use warnings; |
|
108
|
|
|
|
|
219
|
|
|
108
|
|
|
|
|
2793
|
|
7
|
|
|
|
|
|
|
|
8
|
108
|
|
|
108
|
|
519
|
use base 'Validation::Class::Directive'; |
|
108
|
|
|
|
|
184
|
|
|
108
|
|
|
|
|
7567
|
|
9
|
|
|
|
|
|
|
|
10
|
108
|
|
|
108
|
|
574
|
use Validation::Class::Util; |
|
108
|
|
|
|
|
213
|
|
|
108
|
|
|
|
|
698
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '7.900057'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'mixin' => 1; |
16
|
|
|
|
|
|
|
has 'field' => 1; |
17
|
|
|
|
|
|
|
has 'multi' => 0; |
18
|
|
|
|
|
|
|
has 'message' => '%s must not contain less than %s characters'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub validate { |
21
|
|
|
|
|
|
|
|
22
|
168
|
|
|
168
|
0
|
285
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
168
|
|
|
|
|
302
|
my ($proto, $field, $param) = @_; |
25
|
|
|
|
|
|
|
|
26
|
168
|
100
|
66
|
|
|
1293
|
if (defined $field->{min_length} && defined $param) { |
27
|
|
|
|
|
|
|
|
28
|
164
|
|
|
|
|
279
|
my $min_length = $field->{min_length}; |
29
|
|
|
|
|
|
|
|
30
|
164
|
50
|
66
|
|
|
623
|
if ( $field->{required} || $param ) { |
31
|
|
|
|
|
|
|
|
32
|
164
|
100
|
|
|
|
494
|
if (length($param) < $min_length) { |
33
|
|
|
|
|
|
|
|
34
|
12
|
|
|
|
|
83
|
$self->error(@_, $min_length); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
168
|
|
|
|
|
505
|
return $self; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |