X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FTypeConstraint%2FParameterized.pm;h=e71881cf8d7c34c724b0ecf74a590f5ec57badfa;hb=462a3e15a74078a0544eeeba2ebe1efd26ac2327;hp=7bbc54a8a6bd98e7713b5b0a168dee5e60ff5664;hpb=7e4e1ad46fd4c72845b18df57a80cdc03b47c4c4;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/TypeConstraint/Parameterized.pm b/lib/Moose/Meta/TypeConstraint/Parameterized.pm index 7bbc54a..e71881c 100644 --- a/lib/Moose/Meta/TypeConstraint/Parameterized.pm +++ b/lib/Moose/Meta/TypeConstraint/Parameterized.pm @@ -8,7 +8,7 @@ use Scalar::Util 'blessed'; use Carp 'confess'; use Moose::Util::TypeConstraints; -our $VERSION = '0.02'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::TypeConstraint'; @@ -18,6 +18,20 @@ __PACKAGE__->meta->add_attribute('type_parameter' => ( predicate => 'has_type_parameter', )); +sub equals { + my ( $self, $type_or_name ) = @_; + + my $other = Moose::Util::TypeConstraints::find_type_constraint($type_or_name); + + return unless $other->isa(__PACKAGE__); + + return ( + $self->type_parameter->equals( $other->type_parameter ) + and + $self->parent->equals( $other->parent ) + ); +} + sub compile_type_constraint { my $self = shift; @@ -65,6 +79,8 @@ Moose::Meta::TypeConstraint::Parameterized - Higher Order type constraints for M =item B +=item B + =back =head1 BUGS