X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FTypeConstraint.pm;h=f84baf1df1a718c20e19fc4adc1ce60ed6797810;hb=55c22540a16ae9b8989e385af93e838570206d95;hp=1e3736d6e39e1b6552d59b272e5dcb5ff761f248;hpb=6d0815b59db07f71cdbfd978ed6f574e57e2b3ea;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/TypeConstraint.pm b/lib/Moose/Meta/TypeConstraint.pm index 1e3736d..f84baf1 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 = '0.93'; +our $VERSION = '1.15'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -122,7 +124,7 @@ sub get_message { } else { $value = (defined $value ? overload::StrVal($value) : 'undef'); - return "Validation failed for '" . $self->name . "' failed with value $value"; + return "Validation failed for '" . $self->name . "' with value $value"; } } @@ -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; @@ -148,7 +150,7 @@ sub equals { return if $other->has_parent; } - return 1; + return; } sub is_a_type_of { @@ -311,7 +313,7 @@ Moose::Meta::TypeConstraint - The Moose Type Constraint metaclass =head1 DESCRIPTION This class represents a single type constraint. Moose's built-in type -constraints, as well as constraints you define, are all store in a +constraints, as well as constraints you define, are all stored in a L object as objects of this class. @@ -466,9 +468,7 @@ behavior and change how child types are created. =head1 BUGS -All complex software has bugs lurking in it, and this module is no -exception. If you find a bug please either email me, or add the bug -to cpan-RT. +See L for details on reporting bugs. =head1 AUTHOR @@ -476,7 +476,7 @@ Stevan Little Estevan@iinteractive.comE =head1 COPYRIGHT AND LICENSE -Copyright 2006-2009 by Infinity Interactive, Inc. +Copyright 2006-2010 by Infinity Interactive, Inc. L