---
name: "Catmandu::Fix::Condition"
section: "3pm"
platform: "linux"
package: "libcatmandu-perl"
version: "1.2024-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Catmandu::Fix::Condition"
---

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

Role for all Catmandu::Fix conditionals

## NAME

Catmandu::Fix::Condition - Role for all Catmandu::Fix conditionals

## SYNOPSIS

```
        if <Catmandu::Fix::Condition instance>
                <pass_fixes>
        else
                <fail_fixes>
        end
```

## DESCRIPTION

All Catmandu::Fix conditions need to implement Catmandu::Fix::Condition. This subclass of Catmandu::Fix::Base provides a list of fixes that need to be executed when a conditional matches (pass\_fixes) and conditional that need to be executed when a conditional fails (fail\_fixes).

Conditions can be used as inline fixes as well:

```
    use Catmandu::Fix::Condition::exists as => 'has_field';

    my $item = { foo => { bar => 1 } };
    has_field($item, 'foo.bar');    # true
    has_field($item, 'doz');        # false
```

## EXAMPLES

Catmandu core comes with the following conditions:

- •

  all\_equal

- •

  all\_match

- •

  any\_equal

- •

  any\_match

- •

  exists

- •

  greater\_than

- •

  in

- •

  is\_array

- •

  is\_false

- •

  is\_null

- •

  is\_number

- •

  is\_object

- •

  is\_string

- •

  is\_true

- •

  less\_than
