X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FManual%2FTypes.pod;h=1b7d873b72b819712f3c7bfea58129cd0d4a7438;hb=48ac876af2c1991bd6cdba0d54b775a121e01725;hp=cd0dde62ad6727d56f73ef61895872ee47fbba31;hpb=04eec38788d1bd5d30c86c7907d2fae596c0a1fc;p=gitmo%2FMoose.git diff --git a/lib/Moose/Manual/Types.pod b/lib/Moose/Manual/Types.pod index cd0dde6..1b7d873 100644 --- a/lib/Moose/Manual/Types.pod +++ b/lib/Moose/Manual/Types.pod @@ -318,9 +318,7 @@ coercion might be a better answer. For our example above, we might want to be more specific, and insist that output be an object with a C method: - subtype 'CanPrint' - => as 'Object' - => where { $_->can('print') }; + duck_type 'CanPrint', [qw(print)]; We can coerce file handles to an object that satisfies this condition with a simple wrapper class: @@ -360,8 +358,8 @@ make your class internals simpler. The L module exports a number of helper functions for creating specific kinds of types. These include -C, C, and C. See the docs for -details. +C, C, C, and C. See the +docs for details. One helper worth noting is C, which allows you to create a subtype of C that only allows the specified values: