logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

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

Name

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

See Also

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

perl v5.40.0                                       2025-01-17              Catmandu::Fix:...mpleCompareTest(3pm)

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)

return

See Also