* Several things that have been deprecated for a while have been removed. See
the 2.0000 section in Moose::Manual::Delta for details.
+ [BUG FIXES]
+
+ * duck_type type constraints now report reasonable errors when given
+ something which isn't an instance of an object. (t0m)
+
2.0102 Sat, Jun 18, 2011
[ENHANCEMENTS]
return $self->SUPER::get_message(@_);
}
+ return $self->SUPER::get_message($value) unless blessed($value);
+
my @methods = grep { !$value->can($_) } @{ $self->methods };
my $class = blessed $value;
$class ||= $value;
# try with the other constraint form
is( exception { DucktypeTest->new( other_swan => Swan->new ) }, undef, 'but a Swan can honk' );
+my $re = qr/Validation failed for 'DuckType' with value/;
+
+like( exception { DucktypeTest->new( duck => undef ) }, $re, 'Exception for undef' );
+like( exception { DucktypeTest->new( duck => [] ) }, $re, 'Exception for arrayref' );
+like( exception { DucktypeTest->new( duck => {} ) }, $re, 'Exception for hashref' );
+like( exception { DucktypeTest->new( duck => \'foo' ) }, $re, 'Exception for scalar ref' );
+
done_testing;