MooseX::Meta::TypeConstraint::Intersection - An intersection of Moose type constraints
version 0.03
This class represents an intersection of type constraints. An intersection takes multiple type constraints, and is true if all of its member constraints are true.
MooseX::Meta::TypeConstraint::Intersection is a subclass of Moose::Meta::TypeConstraint.
MooseX::Meta::TypeConstraint::Intersection
The member type constraints of this intersection.
This creates a new intersection type constraint based on the given %options.
%options
It takes the same options as its parent. It also requires an additional option, type_constraints. This is an array reference containing the Moose::Meta::TypeConstraint objects that are the members of the intersection type. The name option defaults to the names of all of these member types sorted and then joined by an ampersand (&).
type_constraints
name
Checks a $value against the intersection constraint. If all member constraints accept the value, the value is valid and something true is returned.
$value
A type is considered equal if it is also an intersection type, and the two intersections have the same member types.
This returns the same constraint as the type_constraints method.
Like check, but returns an error message including all of the error messages returned by the member constraints, or undef.
check
undef
Same as validate, but returns an array reference of tuples with error messages and the type constraints that produced them from the individual validation errors instead of a plain string with the errors concatenated.
validate
This returns true if the $other_constraint is also an intersection constraint and contains at least all of the member constraints of the intersection this method is called on.
$other_constraint
Ionzero LLC (http://ionzero.com) for sponsoring the initial development.
Florian Ragwitz <rafl@debian.org>
This software is copyright (c) 2010 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install MooseX::Meta::TypeConstraint::Intersection, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::Meta::TypeConstraint::Intersection
CPAN shell
perl -MCPAN -e shell install MooseX::Meta::TypeConstraint::Intersection
For more information on module installation, please visit the detailed CPAN module installation guide.