| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Valiemon::Attributes::MaxLength; |
|
2
|
3
|
|
|
3
|
|
1436
|
use strict; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
77
|
|
|
3
|
3
|
|
|
3
|
|
10
|
use warnings; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
61
|
|
|
4
|
3
|
|
|
3
|
|
8
|
use utf8; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
11
|
|
|
5
|
3
|
|
|
3
|
|
402
|
use parent qw(Valiemon::Attributes); |
|
|
3
|
|
|
|
|
237
|
|
|
|
3
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
136
|
use Carp qw(croak); |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
492
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
21
|
|
|
21
|
0
|
38
|
sub attr_name { 'maxLength' } |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub is_valid { |
|
12
|
21
|
|
|
21
|
0
|
26
|
my ($class, $context, $schema, $data) = @_; |
|
13
|
|
|
|
|
|
|
|
|
14
|
21
|
50
|
|
|
|
43
|
return 1 unless $context->prims->is_string($data); # ignore |
|
15
|
|
|
|
|
|
|
|
|
16
|
21
|
|
|
|
|
22
|
my $max_length = $schema->{maxLength}; |
|
17
|
|
|
|
|
|
|
$context->in_attr($class, sub { |
|
18
|
21
|
100
|
66
|
21
|
|
34
|
if (!$context->prims->is_integer($max_length) || !(0 <= $max_length)) { |
|
19
|
2
|
|
|
|
|
4
|
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
|
|
|
|
|
57
|
length $data <= $max_length; |
|
23
|
21
|
|
|
|
|
81
|
}); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |