NAME
MooseX::Meta::TypeConstraint::Structured - Structured type constraints.
DESCRIPTION
A structure is a set of Moose::Meta::TypeConstraint that are 'aggregated' in such a way as that they are all applied to an incoming list of arguments. The idea here is that a Type Constraint could be something like, "An Int followed by an Int and then a Str" and that this could be done so with a declaration like:
Tuple[Int,Int,Str]; ## Example syntax
So a structure is a list of Type constraints (the "Int,Int,Str" in the above example) which are intended to function together.
ATTRIBUTES
This class defines the following attributes.
type_constraints
A list of Moose::Meta::TypeConstraint objects.
constraint_generator
A subref or closure that contains the way we validate incoming values against a set of type constraints.
METHODS
This class defines the following methods.
new
Initialization stuff.
generate_constraint_for ($type_constraints)
Given some type constraints, use them to generate validation rules for an ref of values (to be passed at check time)
parameterize (@type_constraints)
Given a ref of type constraints, create a structured type.
compile_type_constraint
hook into compile_type_constraint so we can set the correct validation rules.
create_child_type
modifier to make sure we get the constraint_generator
is_a_type_of
is_subtype_of
equals
Override the base class behavior.
type_constraints_equals
Checks to see if the internal type contraints are equal.
get_message
May want to override this to set a more useful error message
SEE ALSO
The following modules or resources may be of interest.
Moose, Moose::Meta::TypeConstraint
AUTHOR
John Napiorkowski, <jjnapiork@cpan.org>
COPYRIGHT & LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.