line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes::MultipleOf; |
2
|
1
|
|
|
1
|
|
394
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
4
|
1
|
|
|
1
|
|
3
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
5
|
1
|
|
|
1
|
|
17
|
use parent qw(Valiemon::Attributes); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
39
|
use Carp qw(croak); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
160
|
|
8
|
|
|
|
|
|
|
|
9
|
14
|
|
|
14
|
0
|
15
|
sub attr_name { 'multipleOf' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub is_valid { |
12
|
8
|
|
|
8
|
0
|
10
|
my ($class, $context, $schema, $data) = @_; |
13
|
|
|
|
|
|
|
|
14
|
8
|
100
|
|
|
|
17
|
return 1 unless $context->prims->is_number($data); # skip on non-number value |
15
|
|
|
|
|
|
|
|
16
|
7
|
|
|
|
|
12
|
my $attr_name = $class->attr_name(); |
17
|
7
|
|
|
|
|
8
|
my $multiple_of = $schema->{$attr_name}; |
18
|
|
|
|
|
|
|
$context->in_attr($class, sub { |
19
|
7
|
50
|
33
|
7
|
|
9
|
if (!$context->prims->is_number($multiple_of) || !(0 < $multiple_of)) { |
20
|
0
|
|
|
|
|
0
|
croak sprintf '`%s` must be a number. This number must be greater than 0 at %s', |
21
|
|
|
|
|
|
|
$attr_name, $context->position; |
22
|
|
|
|
|
|
|
} |
23
|
7
|
|
|
|
|
12
|
$context->prims->is_integer($data/$multiple_of); |
24
|
7
|
|
|
|
|
24
|
}); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |