The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Data::Schema::Type::Either - Type handler for 'either' type

SYNOPSIS

 use Data::Schema;

DESCRIPTION

'Either' is not really an actual data type, but a way to validate whether a value validates to any one of the specified schemas.

Synonym: or, any

Example schema (in YAML syntax):

 - any
 - of:
     - [int, {divisible_by: 2}]
     - [int, {divisible_by: 7}]

Example valid data:

 42  # divisible by 2 as well as 7

 21  # not divisible by 2 but divisible by 7

 4   # not divisible by 7 but divisible by 2

Example invalid data:

 15 # not divisible by 2 nor 7

TYPE ATTRIBUTES

of => [schema1, schema2, ...]

Specify the schema(s), where the value will need to be valid to one of them.

AUTHOR

Steven Haryanto, <steven at masterweb.net>

COPYRIGHT & LICENSE

Copyright 2009 Steven Haryanto, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.