line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes::MinLength; |
2
|
1
|
|
|
1
|
|
828
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
3
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
4
|
1
|
|
|
1
|
|
6
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
5
|
1
|
|
|
1
|
|
815
|
use parent qw(Valiemon::Attributes); |
|
1
|
|
|
|
|
386
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
77
|
use Carp qw(croak); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
267
|
|
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
0
|
18
|
sub attr_name { 'minLength' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub is_valid { |
12
|
5
|
|
|
5
|
0
|
9
|
my ($class, $context, $schema, $data) = @_; |
13
|
|
|
|
|
|
|
|
14
|
5
|
50
|
|
|
|
18
|
return 1 unless $context->prims->is_string($data); # ignore |
15
|
|
|
|
|
|
|
|
16
|
5
|
|
|
|
|
11
|
my $min_length = $schema->{minLength}; |
17
|
|
|
|
|
|
|
$context->in_attr($class, sub { |
18
|
5
|
100
|
66
|
5
|
|
14
|
if (!$context->prims->is_integer($min_length) || !(0 <= $min_length)) { |
19
|
2
|
|
|
|
|
9
|
croak sprintf '`minLength` must be an integer. This integer must be greater than, or equal to, 0 at %s', |
20
|
|
|
|
|
|
|
$context->position; |
21
|
|
|
|
|
|
|
} |
22
|
3
|
|
|
|
|
15
|
$min_length <= length $data; |
23
|
5
|
|
|
|
|
37
|
}); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |