Test::Proto::Alternation - represent an alternation in array validation
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.
Test::Proto::Base::any_of
Each argument is a different alternative.
die unless exists $alternation->alternatives->[0];
A chainable getter/setter method for the different alternatives available to the alternation.
To install Test::Proto, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Proto
CPAN shell
perl -MCPAN -e shell install Test::Proto
For more information on module installation, please visit the detailed CPAN module installation guide.