| Catmandu::Fix::Condition(3pm) | User Contributed Perl Documentation | Catmandu::Fix::Condition(3pm) |
Catmandu::Fix::Condition - Role for all Catmandu::Fix conditionals
if <Catmandu::Fix::Condition instance>
<pass_fixes>
else
<fail_fixes>
end
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
Catmandu core comes with the following conditions:
| 2023-03-03 | perl v5.36.0 |