myffy has asked for the wisdom of the Perl Monks concerning the following question:
package Person; use Moose; use Moose::Util::TypeConstraints; subtype 'Gender' => as 'Str' => where { /^(female|male)$/ }; has sex => ( is => 'rw', isa => 'Gender' ); package Person; use Moose; use Moose::Util::TypeConstraints; enum Gender => qw(female male); has sex => ( is => 'rw', isa => 'Gender' );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Moose and enum
by FunkyMonk (Bishop) on May 29, 2008 at 08:42 UTC | |
by myffy (Acolyte) on May 29, 2008 at 10:18 UTC | |
by FunkyMonk (Bishop) on May 29, 2008 at 16:00 UTC |