Don't assume that value that fails a duck type constraint is blessed or we get undef...
Dave Rolsky [Thu, 21 Apr 2011 20:33:28 +0000 (15:33 -0500)]
lib/Moose/Meta/TypeConstraint/DuckType.pm

index fa70470..3b1a1c0 100644 (file)
@@ -99,6 +99,8 @@ sub get_message {
 
     my @methods = grep { !$value->can($_) } @{ $self->methods };
     my $class = blessed $value;
+    $class ||= $value;
+
     return $class
          . " is missing methods "
          . english_list(map { "'$_'" } @methods);