On Jun 5, 2010, at 6:34 PM, Sascha Ott <[email protected]> wrote:

>
> Hi!
>
> I am using Moose version 0.79 and MooseX::Declare version 0.22. I am trying
> to work out how to use a self-defined type as the type of method parameters.
> I tried some variations, but I am always running into errors. I can
> constrain types of class attributes, but not the types of the parameters of
> a method.
>
> Does anybody have a sample code snippet showing how this is done
> correctly?
>

Something like:

use Moose::Util::TypeConstraints;
subtype Dahut => as Str => where { $_ eq 'DAHUT' }

method reply (Dahut $call) { say "$call? Daaaahuuuut!" }


Should work

-Chris

Reply via email to