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