From: Dave Rolsky Date: Fri, 27 Mar 2009 21:27:00 +0000 (-0500) Subject: doc cleanup for duck_type X-Git-Tag: 0.73_01~45^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=88b68372bf59bc1e95da9a735535a2c1c81d9ae1;p=gitmo%2FMoose.git doc cleanup for duck_type --- diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index b45ded1..daef718 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -998,19 +998,23 @@ given type. =item B -This will create a subtype of Object and test to make sure the value C -do the methods in C<@methods> +This will create a subtype of Object and test to make sure the value +C do the methods in C<@methods>. + +This is intended as an easy way to accept non-Moose objects that +provide a certain interface. If you're using Moose classes, we +recommend that you use a C-only Role instead. =item B -If passed an ARRRAY reference instead of the C<$name>, C<@methods> pair, this -will create an unnamed duck type. This can be used in an attribute definiton -like so: +If passed an ARRAY reference instead of the C<$name>, C<@methods> +pair, this will create an unnamed duck type. This can be used in an +attribute definiton like so: - has 'cache' => ( - is => 'ro', - isa => duck_type([qw[ get_set ]]), - ); + has 'cache' => ( + is => 'ro', + isa => duck_type( [qw( get_set )] ), + ); =item B