line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::Condition::greater_than; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
673
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
367
|
use Catmandu::Util qw(is_value); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
47
|
|
9
|
1
|
|
|
1
|
|
6
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
10
|
1
|
|
|
1
|
|
359
|
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
|
|
37
|
my ($self) = @_; |
19
|
2
|
|
|
|
|
10
|
my $value = int($self->value); |
20
|
|
|
|
|
|
|
sub { |
21
|
4
|
|
|
4
|
|
9
|
my $v = $_[0]; |
22
|
4
|
50
|
|
|
|
101
|
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::greater_than - Execute fixes when a field is greater than a value |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SYNOPSIS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# greater_than(X,Y) is true when X > Y |
39
|
|
|
|
|
|
|
if greater_than('year','2018') |
40
|
|
|
|
|
|
|
add_field('my.funny.title','true') |
41
|
|
|
|
|
|
|
end |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# greater_than on arrays checks if all values are X > Y |
44
|
|
|
|
|
|
|
if greater_than('years.*','2018') |
45
|
|
|
|
|
|
|
add_field('my.funny.title','true') |
46
|
|
|
|
|
|
|
end |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SEE ALSO |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
L<Catmandu::Fix::Condition::less_than> |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |