1 package MooseX::Meta::TypeConstraint::Structured;
3 use 5.8.8; ## Minimum tested Perl Version
5 use Moose::Util::TypeConstraints;
7 extends 'Moose::Meta::TypeConstraint';
9 our $AUTHORITY = 'cpan:JJNAPIORK';
13 MooseX::Meta::TypeConstraint::Structured - Structured Type Constraints
21 our $VERSION = '0.01';
25 Structured type constraints let you assign an internal pattern of type
26 constraints to a 'container' constraint. The goal is to make it easier to
27 declare constraints like "ArrayRef[Int, Int, Str]" where the constraint is an
28 ArrayRef of three elements and the internal constraint on the three is Int, Int
33 This class defines the following attributes.
37 additional details on the inherited parent attribute
41 This is a signature of internal contraints for the contents of the outer
54 This class defines the following methods.
56 =head2 _normalize_args
58 Get arguments into a known state or die trying
63 my ($self, $args) = @_;
64 if(defined $args && ref $args eq 'ARRAY') {
67 confess 'Arguments not ArrayRef as expected.';
73 The constraint is basically validating the L</signature> against the incoming
80 my @args = $self->_normalize_args(shift);
81 foreach my $idx (0..$#args) {
82 if(my $error = $self->signature->[$idx]->validate($args[$idx])) {
91 John James Napiorkowski <jjnapiork@cpan.org>
95 You may distribute this code under the same terms as Perl itself.