NAME
Catmandu::Fix::Condition - Role for all Catmandu::Fix conditionals
SYNOPSIS
if <Catmandu::Fix::Condition instance>
<pass_fixes>
else
<fail_fixes>
end
DESCRIPTION
All Catmandu::Fix conditions need to implement Catmandu::Fix::Condition. This subclass of Catmandu::Fix::Base provides a list of fixes that need to be executed when a conditional matches (pass_fixes) and conditional that need to be executed when a conditional fails (fail_fixes).
Conditions can be used as inline fixes as well:
use Catmandu::Fix::Condition::exists as => 'has_field';
my $item = { foo => { bar => 1 } };
has_field($item, 'foo.bar'); # true
has_field($item, 'doz'); # false
EXAMPLES
Catmandu core comes with the following conditions: