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.0204~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2bd71c26367a49e273c365db94da1f515230150a;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; };