1 package MooseX::Meta::TypeConstraint::Role::Structured;
4 use Moose::Util::TypeConstraints;
5 requires qw(_normalize_args signature_equals);
9 MooseX::Meta::TypeConstraint::Role::Structured - Structured Type Constraints
13 This Role defines the interface and basic behavior of Structured Type Constraints.
17 The following types are defined in this class.
19 =head2 Moose::Meta::TypeConstraint
21 Used to make sure we can properly validate incoming signatures.
25 class_type 'Moose::Meta::TypeConstraint';
29 This class defines the following attributes.
33 This is a signature of internal contraints for the contents of the outer
44 =head2 optional_signature
46 This is a signature of internal contraints for the contents of the outer
47 contraint container. These are optional constraints.
51 has 'optional_signature' => (
54 predicate=>'has_optional_signature',
59 This class defines the following methods.
63 modifier to make sure equals descends into the L</signature>
67 around 'equals' => sub {
68 my ($equals, $self, $compared_type_constraint) = @_;
70 ## Make sure we are comparing typeconstraints of the same base class
71 return unless $compared_type_constraint->isa(__PACKAGE__);
73 ## Make sure the base equals is also good
74 return unless $self->$equals($compared_type_constraint);
76 ## Make sure the signatures match
77 return unless $self->signature_equals($compared_type_constraint);
79 ## If we get this far, the two are equal
85 John James Napiorkowski <jjnapiork@cpan.org>
89 You may distribute this code under the same terms as Perl itself.