Catman...AllTest(3pm)

πŸ“¦
version 1.2025 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Catmandu::Fix::Condition::SimpleAllTest β€” bestie, it's the base class that makes building "all match" conditionals so much easier πŸŽ€


✨ SYNOPSIS ✨

package Catmandu::Fix::Condition::is_even

use Catmandu::Sane;
use Moo;
use Catmandu::Fix::Has;

has path => (fix_arg => 1);

with 'Catmandu::Fix::Condition::SimpleAllTest';

sub emit_test {
    my ($self, $var) = @_;
    "is_value(${var}) && ${var} % 2 == 0";
}

1;

# Now you can write in your fixes
is_even('my_field')    # True when my_field is 0,2,4,6,...
is_even('my_field.*')  # True when all my_field's are 0,2,4,6,...

okay so literally you roll your own condition, you with 'Catmandu::Fix::Condition::SimpleAllTest', and boom πŸ’₯ β€” you get both the single-field vibe and the all-the-fields vibe for free. The way that is_even('my_field') is true when my_field is 0,2,4,6,... and is_even('my_field.*') is true when all of my_field's are 0,2,4,6,...? Obsessed. πŸ‘‘


🌸 DESCRIPTION 🌸

So this is a base class, and its whole job is to ease the construction of Catmandu::Fix::Conditional-s 🫢. An 'all' test matches when all node on a path match a condition β€” every single one, no skips, no cap. fr fr.

Like, check it:

all_match('title','abc')    # true when the title field contains 'abc'

all_match('title.*','abc')  # true when all title fields contain 'abc'

See the difference? First one is giving one field, one vibe. Second one with the .* is giving every title field must pass πŸ’… β€” if even one of them doesn't contain 'abc', the whole test says nope.


πŸ’œ SEE ALSO πŸ’œ

  • Catmandu::Fix::Condition::all_match
  • Catmandu::Fix::Condition::greater_than
  • Catmandu::Fix::Condition::less_than

and that's the whole page, bestie πŸ¦‹ β€” this one's from perl v5.40.1, dated 2026-01-24, and it lives under Catman...AllTest(3pm). go build something iconic with it, ily, bye πŸ’–βœ¨

πŸ“¦ where this page comes from