line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: MinAlpha Directive for Validation Class Field Definitions |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Validation::Class::Directive::MinAlpha; |
4
|
|
|
|
|
|
|
|
5
|
108
|
|
|
108
|
|
67807
|
use strict; |
|
108
|
|
|
|
|
303
|
|
|
108
|
|
|
|
|
2886
|
|
6
|
108
|
|
|
108
|
|
578
|
use warnings; |
|
108
|
|
|
|
|
199
|
|
|
108
|
|
|
|
|
2929
|
|
7
|
|
|
|
|
|
|
|
8
|
108
|
|
|
108
|
|
513
|
use base 'Validation::Class::Directive'; |
|
108
|
|
|
|
|
187
|
|
|
108
|
|
|
|
|
7758
|
|
9
|
|
|
|
|
|
|
|
10
|
108
|
|
|
108
|
|
629
|
use Validation::Class::Util; |
|
108
|
|
|
|
|
194
|
|
|
108
|
|
|
|
|
727
|
|
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 alphabetic characters'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub validate { |
21
|
|
|
|
|
|
|
|
22
|
4
|
|
|
4
|
0
|
5
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
4
|
|
|
|
|
9
|
my ($proto, $field, $param) = @_; |
25
|
|
|
|
|
|
|
|
26
|
4
|
50
|
33
|
|
|
24
|
if (defined $field->{min_alpha} && defined $param) { |
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
7
|
my $min_alpha = $field->{min_alpha}; |
29
|
|
|
|
|
|
|
|
30
|
4
|
50
|
33
|
|
|
20
|
if ( $field->{required} || $param ) { |
31
|
|
|
|
|
|
|
|
32
|
4
|
|
|
|
|
27
|
my @i = ($param =~ /[a-zA-Z]/g); |
33
|
|
|
|
|
|
|
|
34
|
4
|
100
|
|
|
|
15
|
if (@i < $min_alpha) { |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
10
|
$self->error(@_, $min_alpha); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
4
|
|
|
|
|
12
|
return $self; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |