line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: MinSymbols Directive for Validation Class Field Definitions |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Validation::Class::Directive::MinSymbols; |
4
|
|
|
|
|
|
|
|
5
|
108
|
|
|
108
|
|
2542774
|
use strict; |
|
108
|
|
|
|
|
296
|
|
|
108
|
|
|
|
|
3298
|
|
6
|
108
|
|
|
108
|
|
641
|
use warnings; |
|
108
|
|
|
|
|
207
|
|
|
108
|
|
|
|
|
3685
|
|
7
|
|
|
|
|
|
|
|
8
|
108
|
|
|
108
|
|
648
|
use base 'Validation::Class::Directive'; |
|
108
|
|
|
|
|
204
|
|
|
108
|
|
|
|
|
61441
|
|
9
|
|
|
|
|
|
|
|
10
|
108
|
|
|
108
|
|
644
|
use Validation::Class::Util; |
|
108
|
|
|
|
|
212
|
|
|
108
|
|
|
|
|
478
|
|
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 special characters'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub validate { |
21
|
|
|
|
|
|
|
|
22
|
6
|
|
|
6
|
0
|
11
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
6
|
|
|
|
|
14
|
my ($proto, $field, $param) = @_; |
25
|
|
|
|
|
|
|
|
26
|
6
|
50
|
33
|
|
|
41
|
if (defined $field->{min_symbols} && defined $param) { |
27
|
|
|
|
|
|
|
|
28
|
6
|
|
|
|
|
12
|
my $min_symbols = $field->{min_symbols}; |
29
|
|
|
|
|
|
|
|
30
|
6
|
50
|
33
|
|
|
33
|
if ( $field->{required} || $param ) { |
31
|
|
|
|
|
|
|
|
32
|
6
|
|
|
|
|
33
|
my @i = ($param =~ /[^a-zA-Z0-9]/g); |
33
|
|
|
|
|
|
|
|
34
|
6
|
100
|
|
|
|
23
|
if (@i < $min_symbols) { |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
|
|
22
|
$self->error(@_, $min_symbols); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
6
|
|
|
|
|
21
|
return $self; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |