line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes::MinLength; |
2
|
3
|
|
|
3
|
|
1941
|
use strict; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
90
|
|
3
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
74
|
|
4
|
3
|
|
|
3
|
|
15
|
use utf8; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
15
|
|
5
|
3
|
|
|
3
|
|
535
|
use parent qw(Valiemon::Attributes); |
|
3
|
|
|
|
|
316
|
|
|
3
|
|
|
|
|
15
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
178
|
use Carp qw(croak); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
582
|
|
8
|
|
|
|
|
|
|
|
9
|
22
|
|
|
22
|
0
|
70
|
sub attr_name { 'minLength' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub is_valid { |
12
|
22
|
|
|
22
|
0
|
60
|
my ($class, $context, $schema, $data) = @_; |
13
|
|
|
|
|
|
|
|
14
|
22
|
50
|
|
|
|
68
|
return 1 unless $context->prims->is_string($data); # ignore |
15
|
|
|
|
|
|
|
|
16
|
22
|
|
|
|
|
48
|
my $min_length = $schema->{minLength}; |
17
|
|
|
|
|
|
|
$context->in_attr($class, sub { |
18
|
22
|
100
|
100
|
22
|
|
56
|
if (!$context->prims->is_integer($min_length) || !(0 <= $min_length)) { |
19
|
2
|
|
|
|
|
6
|
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
|
|
|
|
|
76
|
$min_length <= length $data; |
23
|
22
|
|
|
|
|
131
|
}); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |