line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::Condition::less_than; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
718
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
366
|
use Catmandu::Util qw(is_value); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
9
|
1
|
|
|
1
|
|
7
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
10
|
1
|
|
|
1
|
|
340
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
13
|
|
|
|
|
|
|
has value => (fix_arg => 1); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
with 'Catmandu::Fix::Condition::Builder::Simple'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _build_value_tester { |
18
|
2
|
|
|
2
|
|
22
|
my ($self) = @_; |
19
|
2
|
|
|
|
|
9
|
my $value = int($self->value); |
20
|
|
|
|
|
|
|
sub { |
21
|
4
|
|
|
4
|
|
8
|
my $v = $_[0]; |
22
|
4
|
50
|
|
|
|
112
|
is_value($v) && $v < $value; |
23
|
2
|
|
|
|
|
12
|
}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__ |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=pod |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Catmandu::Fix::Condition::less_than - Excute fixes when a field is less than a value |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SYNOPSIS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# less_than(X,Y) is true when X < Y |
39
|
|
|
|
|
|
|
if less_than('year','2018') |
40
|
|
|
|
|
|
|
add_field('my.funny.title','true') |
41
|
|
|
|
|
|
|
end |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# less_than on arrays checks if all values are X < Y |
44
|
|
|
|
|
|
|
if less_than('years.*','2018') |
45
|
|
|
|
|
|
|
add_field('my.funny.title','true') |
46
|
|
|
|
|
|
|
end |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SEE ALSO |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
L<Catmandu::Fix::Condition::greater_than> |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |