From: Florian Ragwitz Date: Thu, 25 Aug 2011 13:24:33 +0000 (+0200) Subject: Make the duck type constraint closure check for blessing X-Git-Tag: 2.0300~114 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2ff80bf401025115a1cdbebf9569f79ce4a7f850;p=gitmo%2FMoose.git Make the duck type constraint closure check for blessing It's what the inlined variant already does. Synchronise with it. --- diff --git a/lib/Moose/Meta/TypeConstraint/DuckType.pm b/lib/Moose/Meta/TypeConstraint/DuckType.pm index a6b13b4..09f0b86 100644 --- a/lib/Moose/Meta/TypeConstraint/DuckType.pm +++ b/lib/Moose/Meta/TypeConstraint/DuckType.pm @@ -39,7 +39,7 @@ sub new { my @methods = @{ $args{methods} }; $args{constraint} = sub { my $val = $_[0]; - blessed($val) ne 'Regexp' + blessed($val) && blessed($val) ne 'Regexp' && all { $val->can($_) } @methods; };