develooper Front page | perl.moose | Postings from January 2010

Re: TypeConstraints message

Thread Previous | Thread Next
From:
Hans Dieter Pearcey
Date:
January 19, 2010 04:55
Subject:
Re: TypeConstraints message
Message ID:
1263905376-sup-4220@glaive.weftsoar.net
Excerpts from Dermot's message of Tue Jan 19 07:34:35 -0500 2010:
> subtype 'IndexType'
>                 => as 'Str',
>                 => enum( $_, qw[foo bar baz]);

enum() is already a Str, and in any case the syntax you made up doesn't
correspond to anything.

You want the anonymous enum syntax.  Just subtype it:

  subtype 'Whatever', as enum([ qw(foo bar baz) ]), ...;

This is all in Moose::Util::TypeConstraints.

hdp.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About