Catman...on::in(3pm)
π NAME π
Catmandu::Fix::Condition::in β bestie, this one only lets your fixes run when the data in one path is contained in another path. That's it, that's the whole vibe. β¨
It's a Condition fix, so it lives inside if / unless blocks and decides whether the stuff inside them actually happens. π
πΈ SYNOPSIS πΈ
Okay so first up, comparing single values. If foo is 42 and bar is 42, then in(foo,bar) is true, and the fix inside runs:
#-------------------------------------------------------------------
# Compare single values
# foo => 42 , bar => 42 => in(foo,bar) -> true
if in(foo,bar)
add_field(forty_two,ok)
end
Now when you're comparing a single value against an array, it's a whole different energy β you're testing whether that value is inside the array:
# When comparing single values to an array: test if the value is
# contained in the array
# foo => 1 , bar => [3,2,1] => in(foo,bar) -> true
if in(foo,bar)
add_field(test,ok)
end
# foo => 42 , bar => [1,2,3] => in(foo,bar) -> false
unless in(foo,bar)
add_field(test,ok)
end
And then the examples go full pseudo-code, spelling out the true / false of a bunch of in() comparisons. Pseudo code, bestie, not real Perl β don't @ me:
# In the following examples we'll write in pseudo code the true/false
# values of some 'in()' comparissons
# scalars vs arrays - check if the value is in the array
foo: 42 , bar: [1,2,3] in(foo,bar) -> false
foo: 1 , bar: [1,2,3] in(foo,bar) -> true
# scalars vs hashes - check if the key is in the hash
foo: name , bar: { name => 'Patrick' } in(foo,bar) -> true
foo: name , bar: { deep => {name => 'Nicolas'}} in(foo,bar) -> false
# array vs array - check if the contents is equal
foo: [1,2] , bar: [1,2] in(foo,bar) -> true
foo: [1,2] , bar: [1,2,3] in(foo,bar) -> false
foo: [1,2] , bar: [[1,2],3] in(foo,bar) -> false
So real quick, the rules of the road, spelled out:
- scalar vs array β checks if the value is in the array π
- scalar vs hash β checks if the key is in the hash (top level only, no digging, we saw
deepsay no ma'am) π³οΈ - array vs array β checks if the contents are equal π
π STATUS π
Heads up bestie β be aware this function is experimental in many perl versions. So like, it works, but it's giving "still cooking". Use with love and maybe a test suite. π«Ά
π¦ SEE ALSO π¦
Catmandu::Fix
That's the whole page, babes. Written by the Perl documentation crew, shipped as perl v5.40.1, dated 2026-01-24. Go forth and conditionally fix things. πβ¨
π¦ 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