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:
• |
all_equal |
|||
• |
all_match |
|||
• |
any_equal |
|||
• |
any_match |
|||
• |
exists |
|||
• |
greater_than |
|||
• |
in |
|||
• |
is_array |
|||
• |
is_false |
|||
• |
is_null |
|||
• |
is_number |
|||
• |
is_object |
|||
• |
is_string |
|||
• |
is_true |
|||
• |
less_than |