X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse%2FAttribute.pm;fp=lib%2FMouse%2FAttribute.pm;h=bc897ab667fd310fe875441e7985f0a3e6dd3a2a;hp=1e60e214abd27bb2226aaaa68cb234dcf772f5bd;hb=3301fa546394abbef62f5a7f9bbfc1c49ae6eb50;hpb=446d2d2c808c8d85b8845659755ec6078dcd7ea9 diff --git a/lib/Mouse/Attribute.pm b/lib/Mouse/Attribute.pm index 1e60e21..bc897ab 100644 --- a/lib/Mouse/Attribute.pm +++ b/lib/Mouse/Attribute.pm @@ -4,6 +4,7 @@ use strict; use warnings; use Carp 'confess'; +use Scalar::Util 'blessed'; sub new { my $class = shift; @@ -197,7 +198,7 @@ sub find_type_constraint { my $checker = Mouse::TypeRegistry->optimized_constraints->{$type}; return $checker if $checker; - confess "Unable to parse type constraint '$type'"; + return sub { blessed($_) && blessed($_) eq $type }; } sub verify_type_constraint {