Catman...dition(3pm)
π¦ Catman...dition(3pm) π
okay so bestie, welcome to the Catman...dition(3pm) page β it lives in section 3pm of the User Contributed Perl Documentation, and it's literally the blueprint for every single conditional in Catmandu. no cap. let's get into it π«Ά
β¨ NAME β¨
Catmandu::Fix::Condition β the Role for all Catmandu::Fix conditionals. it's giving "everyone who wants to be a condition has to sign this contract" π
πΈ SYNOPSIS πΈ
the whole vibe in code form, bestie:
if <Catmandu::Fix::Condition instance>
<pass_fixes>
else
<fail_fixes>
end
like. it's an if/else. but make it Catmandu. iconic. π
π DESCRIPTION π
so here's the tea β β every Catmandu::Fix condition out there needs to implement Catmandu::Fix::Condition. that's not optional, that's the rule, periodt.
this class is a subclass of Catmandu::Fix::Base, and what it brings to the group chat is two little lists:
- a list of fixes that get executed when the conditional matches β that's your
pass_fixesπ - and a conditional that needs to be executed when the conditional fails β that's your
fail_fixesπ
ngl, that second sentence is worded a liiittle cursed in the original, but the energy is: pass fixes fire on a match, fail fixes fire on a no-match. you got this π
and plot twist β conditions can be used as inline fixes too! not just in the if/else block. look:
use Catmandu::Fix::Condition::exists as => 'has_field';
my $item = { foo => { bar => 1 } };
has_field($item, 'foo.bar'); # true
has_field($item, 'doz'); # false
see how foo.bar is true because it exists, and doz is false because... it does not? slay. that's the whole bit. π§
π EXAMPLES π
Catmandu core comes with these conditions, and honestly? the lineup ate. here's the full roster, no skips, no cuts:
all_equalall_matchany_equalany_matchexistsgreater_thaninis_arrayis_falseis_nullis_numberis_objectis_stringis_trueless_than
sixteen of them. a whole squad. πβ
and that's the page!! π this lil masterpiece comes to you from perl v5.40.1, dated 2026-01-24, and it's filed under that same Catman...dition(3pm) energy. go write a conditional, bestie, you're the main character now π β¨
π¦ where this page comes from
- ubuntu resolute: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms