From: Fuji, Goro Date: Sun, 7 Nov 2010 12:02:59 +0000 (+0900) Subject: Tweaks X-Git-Tag: 0.83~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dbf2d5d48aa00b6b2a98dc788d6c3323ab760aee;p=gitmo%2FMouse.git Tweaks --- diff --git a/lib/Mouse/Util/TypeConstraints.pm b/lib/Mouse/Util/TypeConstraints.pm index c6917fd..f76b249 100644 --- a/lib/Mouse/Util/TypeConstraints.pm +++ b/lib/Mouse/Util/TypeConstraints.pm @@ -186,7 +186,7 @@ sub subtype { sub coerce { # coerce $type, from $from, via { ... }, ... my $type_name = shift; my $type = find_type_constraint($type_name) - or Carp::croak("Cannot find type '$type_name', perhaps you forgot to load it."); + or Carp::croak("Cannot find type '$type_name', perhaps you forgot to load it"); $type->_add_type_coercions(@_); return; @@ -383,10 +383,7 @@ sub register_type_constraint { my($constraint) = @_; Carp::croak("No type supplied / type is not a valid type constraint") unless Mouse::Util::is_a_type_constraint($constraint); - my $name = $constraint->name; - Carp::croak("Can't register an unnamed type constraint") - unless defined $name; - return $TYPE{$name} = $constraint; + return $TYPE{$constraint->name} = $constraint; } sub find_or_parse_type_constraint {