Subject: | Moose.pm's documentation for 'isa' => needs to refer to Moose/Util/TypeConstraints.pm |
Hi all!
Today when working with Moose on a new module, I needed to define a
new type. However, the documentation for Moose.pm says this on 'isa':
<<<<<<<<<<
isa => $type_name
The isa option uses Moose's type constraint facilities to set up
runtime type checking for this attribute. Moose will perform the
checks during class construction, and within any accessors. The
$type_name argument must be a string. The string may be either a class
name or a type defined using Moose's type definition features.
Show quoted text
>>>>>>>>>>
Nowhere does it say how to define a new type.
So I went on IRC and asked, and phaylon answered that I should refer
to Moose::Util::TypeConstraints (thanks!). However, it's still a
problem with the documentation. The attached patch against the svn
trunk fixes this problem. Please apply it.
For more information on why this is needed, see the "Fix everything
two ways" item here:
http://www.joelonsoftware.com/articles/customerservice.html
Regards,
Shlomi Fish
Subject: | Moose-link-to-util-type.diff |
Index: lib/Moose.pm
===================================================================
--- lib/Moose.pm (revision 2511)
+++ lib/Moose.pm (working copy)
@@ -394,7 +394,8 @@
type checking for this attribute. Moose will perform the checks during class
construction, and within any accessors. The C<$type_name> argument must be a
string. The string may be either a class name or a type defined using
-Moose's type definition features.
+Moose's type definition features. (Refer to L<Moose::Util::TypeConstraints>
+for information on how to define a new type).
=item I<coerce =E<gt> (1|0)>