From: Matt S Trout Date: Wed, 10 Jun 2009 19:34:42 +0000 (+0100) Subject: mention MooseX::Types early to avoid users falling down a rathole X-Git-Tag: 0.82~18^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0671201413790328672679329cfd7ce1dcc2468d;p=gitmo%2FMoose.git mention MooseX::Types early to avoid users falling down a rathole --- diff --git a/lib/Moose/Manual/Types.pod b/lib/Moose/Manual/Types.pod index ab67bfb..a18605c 100644 --- a/lib/Moose/Manual/Types.pod +++ b/lib/Moose/Manual/Types.pod @@ -183,6 +183,21 @@ recommend that you centralize all of these definitions in a single package, C, which can be loaded by other classes in your application. +Once you're doing this, you should almost certainly look at the +L extension which allows easy declaration of type libraries +and can export your types as perl constants so that you can refer to them +as just + + has 'counter' => (is => 'rw', isa => PositiveInt); + +rather than needing to fully qualify them everywhere. It also allows + + has 'counts' => (is => 'ro', isa => HashRef[PositiveInt]); + +and similarly for the union and other syntaxes discussed below, which +will compile time check your use of names and is generally more robust +than the string type parsing for complex cases. + =head1 COERCION One of the most powerful features of Moose's type system is its