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