Steven Haryanto > Data-Schema-0.136 > Data::Schema::Type::All

Download:
Data-Schema-0.136.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.136   Source  

NAME ^

Data::Schema::Type::All - Type handler for 'all' type

VERSION ^

version 0.136

SYNOPSIS ^

 use Data::Schema;

DESCRIPTION ^

'All' is not really an actual data type, but a way to validate whether a value validates to all of the specified schemas. 'And' is another name for this type.

Example schema (in YAML syntax):

 - all
 - schemas:
     - [int, {divisible_by: 2}]
     - [int, {divisible_by: 7}]

Example valid data:

 42  # divisible by 2 as well as 7

Example invalid data:

 21  # divisible by 7 but not by 2

 4   # divisible by 2 but not by 7

 15  # not divisible by 2 nor 7

TYPE ATTRIBUTES ^

All is Scalar, so you might want to consult the docs of those roles to see what type attributes are available.

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

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

AUTHOR ^

  Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2009 by Steven Haryanto.

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

syntax highlighting: