X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FTypeConstraint.pm;h=532f1e7d115a5665c36c26dc01d3de5917a2df00;hb=ae7820b1b884344a7ee90d94b484ca46459eb7b1;hp=bac571a94e45b304d434c4be8c1a9cb1ed7f2296;hpb=e462f6f3d260687b8f7372b112a50c5c2a2c431c;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/TypeConstraint.pm b/lib/Moose/Meta/TypeConstraint.pm index bac571a..532f1e7 100644 --- a/lib/Moose/Meta/TypeConstraint.pm +++ b/lib/Moose/Meta/TypeConstraint.pm @@ -5,7 +5,9 @@ use strict; use warnings; use metaclass; -use overload '""' => sub { shift->name }, # stringify to tc name +use overload '0+' => sub { refaddr(shift) }, # id an object + '""' => sub { shift->name }, # stringify to tc name + bool => sub { 1 }, fallback => 1; use Scalar::Util qw(blessed refaddr); @@ -13,7 +15,7 @@ use Sub::Name qw(subname); use base qw(Class::MOP::Object); -our $VERSION = '1.05'; +our $VERSION = '1.06'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -133,7 +135,7 @@ sub equals { my $other = Moose::Util::TypeConstraints::find_type_constraint($type_or_name) or return; - return 1 if refaddr($self) == refaddr($other); + return 1 if $self == $other; if ( $self->has_hand_optimized_type_constraint and $other->has_hand_optimized_type_constraint ) { return 1 if $self->hand_optimized_type_constraint == $other->hand_optimized_type_constraint;