Scroll to navigation

Catmandu::Fix::Condition::SimpleCompareTest(3pm) User Contributed Perl Documentation Catmandu::Fix::Condition::SimpleCompareTest(3pm)

NAME

Catmandu::Fix::Condition::SimpleCompareTest - Base class to ease the construction of compare conditionals

SYNOPSIS

   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)

SEE ALSO

Catmandu::Fix::Condition::SimpleAllTest, Catmandu::Fix::Condition::SimpleAnyTest

2023-03-03 perl v5.36.0