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
|
109
|
|
|
109
|
|
53195
|
use strict; |
|
109
|
|
|
|
|
296
|
|
|
109
|
|
|
|
|
3241
|
|
6
|
109
|
|
|
109
|
|
670
|
use warnings; |
|
109
|
|
|
|
|
296
|
|
|
109
|
|
|
|
|
3011
|
|
7
|
|
|
|
|
|
|
|
8
|
109
|
|
|
109
|
|
612
|
use base 'Validation::Class::Directive'; |
|
109
|
|
|
|
|
278
|
|
|
109
|
|
|
|
|
10657
|
|
9
|
|
|
|
|
|
|
|
10
|
109
|
|
|
109
|
|
853
|
use Validation::Class::Util; |
|
109
|
|
|
|
|
280
|
|
|
109
|
|
|
|
|
741
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '7.900059'; # 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
|
171
|
|
|
171
|
0
|
353
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
171
|
|
|
|
|
406
|
my ($proto, $field, $param) = @_; |
25
|
|
|
|
|
|
|
|
26
|
171
|
100
|
66
|
|
|
858
|
if (defined $field->{min_length} && defined $param) { |
27
|
|
|
|
|
|
|
|
28
|
167
|
|
|
|
|
360
|
my $min_length = $field->{min_length}; |
29
|
|
|
|
|
|
|
|
30
|
167
|
50
|
66
|
|
|
567
|
if ( $field->{required} || $param ) { |
31
|
|
|
|
|
|
|
|
32
|
167
|
100
|
|
|
|
554
|
if (length($param) < $min_length) { |
33
|
|
|
|
|
|
|
|
34
|
12
|
|
|
|
|
82
|
$self->error(@_, $min_length); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
171
|
|
|
|
|
433
|
return $self; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |