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