« blib/lib/Catmandu/Fix/Condition/any_equal.pm
↑ Summary
blib/lib/Catmandu/Fix/Condition/less_than.pm »
| 1 | package Catmandu::Fix::Condition::greater_than; | ||
| 2 | |||
| 3 | 1 | ▶ | use Catmandu::Sane; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | our $VERSION = '1.0201_02'; | |
| 6 | |||
| 7 | 1 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use Catmandu::Fix::Has; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 1 | has path => (fix_arg => 1); | |
| 12 | 1 | has value => (fix_arg => 1); | |
| 13 | |||
| 14 | 1 | with 'Catmandu::Fix::Condition::SimpleAllTest'; | |
| 15 | |||
| 16 | sub emit_test { | ||
| 17 | 2 | ▶ | my ($self, $var) = @_; |
|
Subroutine
emit_test: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 18 | 2 | my $value = $self->value; | |
| 19 | 2 | "is_value(${var}) && ${var} > int('$value')"; | |
| 20 | } | ||
| 21 | |||
| 22 | 1 | 1; | |
| 23 | |||
| 24 | __END__ | ||
| 25 | |||
| 26 | =pod | ||
| 27 | |||
| 28 | =head1 NAME | ||
| 29 | |||
| 30 | Catmandu::Fix::Condition::greater_than - Excute fixes when a field is greater than a value | ||
| 31 | |||
| 32 | =head1 SYNOPSIS | ||
| 33 | |||
| 34 | # greater_than(X,Y) is true when X > Y | ||
| 35 | if greater_than('year','2018') | ||
| 36 | add_field('my.funny.title','true') | ||
| 37 | end | ||
| 38 | |||
| 39 | # greater_than on arrays checks if all values are X > Y | ||
| 40 | if greater_than('years.*','2018') | ||
| 41 | add_field('my.funny.title','true') | ||
| 42 | end | ||
| 43 | |||
| 44 | =head1 SEE ALSO | ||
| 45 | |||
| 46 | L<Catmandu::Fix::Condition::less_than> | ||
| 47 | |||
| 48 | =cut | ||