++ed by:
MJEMMESON

1 PAUSE user

Daniel Perrett
and 1 contributors

NAME

Test::Proto::Alternation - represent an alternation in array validation

SYNOPSIS

        pArray->contains_only(pAlternation('a', pSeries('b', 'c'))); 
        # will validate ['a'] and ['b', 'c'] as true

Used in array validation to represent different options. Equivalent to | in a regular expression. There is no limit to the number of alternatives which may be specified, but there must be at least one. This can handle nested Test::Proto::Series and Test::Proto::Repeatable elements, and can be nested within them.

For single-item alternation consider using Test::Proto::Base::any_of.

METHODS

new

Each argument is a different alternative.

alternatives

        die unless exists $alternation->alternatives->[0];

A chainable getter/setter method for the different alternatives available to the alternation.