Catman...areTest(3pm)
π NAME π
okay so bestie, this is Catmandu::Fix::Condition::SimpleCompareTest β a 3pm perl manual page, no cap β¨
it's the base class you inherit from when you wanna make compare conditionals without doing all the boring scaffolding yourself. it exists purely to make your life easier, and honestly? it ate. π
πΈ SYNOPSIS πΈ
here's the whole vibe, literally copy-paste energy:
package Catmandu::Fix::Condition::has_equal_type
use Catmandu::Sane;
use Moo;
use Catmandu::Fix::Has;
has path => (fix_arg => 1);
has path2 => (fix_arg => 1);
with 'Catmandu::Fix::Condition::SimpleCompareTest';
sub emit_test {
my ($self, $var, $var2, $fixer) = @_;
"is_value(${var}) && is_value(${var2}) && ref ${var} eq ref ${var2}";
}
1;
# Now you can write in your fixes
has_equal_type(my_field_1,my_field_2) # True when my_field_1 and my_field_2 have
# the same refence type (both scalas, arrays, hashes)
so the way this works is π«Ά you use Catmandu::Sane;, use Moo;, and use Catmandu::Fix::Has;, then declare your args with has path => (fix_arg => 1); and has path2 => (fix_arg => 1);. then you pull in the base class with with 'Catmandu::Fix::Condition::SimpleCompareTest'; and write your very own emit_test sub that takes ($self, $var, $var2, $fixer) and returns the test string. then slap a 1; at the bottom so perl is happy and you're done. iconic. π
once that's built you get to use it in your fixes like has_equal_type(my_field_1,my_field_2), which is True when my_field_1 and my_field_2 have the same refence type (both scalas, arrays, hashes). yes we're keeping the typo, it's part of the lore now. π
π¦ SEE ALSO π¦
Catmandu::Fix::Condition::SimpleAllTestCatmandu::Fix::Condition::SimpleAnyTest
ngl, this is a base class, so you don't call it directly β you with it and let it carry you. main character energy only. β¨
k bye bestie, go build something cute π
this page ships with perl v5.40.1, dated 2026-01-24 β mwah, xoxo π
π¦ 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