Catmandu::Fix::Condition::SimpleAnyTest(3pm)

Catmandu::Fix::Condition::SimpleAnyTest3pm

Base class to ease the construction of any match conditionals

Usage

   package Catmandu::Fix::Condition::has_even
   use Catmandu::Sane;
   use Moo;
   use Catmandu::Fix::Has;
   has path    => (fix_arg => 1);
   with 'Catmandu::Fix::Condition::SimpleAnyTest';
 
   sub emit_test {
       my ($self, $var) = @_;
       my $value = $self->value;
       "is_value(${var}) && ${var} % 2 == 0";
   }
   1;
   # Now you can write in your fixes
   has_even('my_field')    # True when my_field is 0,2,4,6,...
   has_even('my_field.*')  # True when at least one my_field is 0,2,4,6,...

Overview

The is a base class to ease the construction of Catmandu::Fix::Conditional-s. An 'any' test matches when at least one node on a path match a condition. E.g.

   any_match('title','abc')    # true when the title field contains 'abc'
   any_match('title.*','abc')  # true when at least one title fields contain 'abc'

Releases

6 releases since Debian 8 (Jessie); the text changed 5 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13

From libcatmandu-perl 1.2024-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.