From: Ricardo Signes Date: Tue, 2 Nov 2010 18:18:00 +0000 (-0400) Subject: clarify how to define multiple coercions X-Git-Tag: 1.9900~62 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f55dd47ffcd014c9d917351b5d2e57ab9210ca27;p=gitmo%2FMoose.git clarify how to define multiple coercions --- diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index 364fb49..521367c 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -1279,11 +1279,17 @@ See the L for an example of how to use these. =over 4 -=item B<< coerce 'Name' => from 'OtherName' => via { ... } >> +=item B<< coerce 'Name' => from 'OtherName' => via { ... } >> This defines a coercion from one type to another. The C argument is the type you are coercing I. +To define multiple coercions, supply more sets of from/via pairs: + + coerce 'Name' => + from 'OtherName' => via { ... }, + from 'ThirdName' => via { ... }; + =item B This is just sugar for the type coercion construction syntax.