Catmandu::Fix::Condition3pm
Role for all catmandu::fix conditionals
Usage
if <Catmandu::Fix::Condition instance><pass_fixes>else<fail_fixes>end
Overview
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'); # truehas_field($item, 'doz'); # false
Examples
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 |
Releases
6 releases since Debian 8 (Jessie); the text changed 5 times.