in reply to Moose and enum
Can you show us the code that doesn't fail, because
package Person; use Moose; use Moose::Util::TypeConstraints; enum Gender => qw(female male); has sex => ( is => 'rw', isa => 'Gender' ); package main; my $M = Person->new( sex => '' ); # fails #$M->sex( 'please' ); # fails
both fail for me (Uncaught exception from user code: Attribute (sex) does not pass the type constraint because: Validation failed for 'Gender' failed).
Update:
$ perl -MMoose -E 'say $Moose::VERSION' 0.44 $ perl -MMoose::Util::TypeConstraints -E 'say $Moose::Util::TypeConstr +aints::VERSION' 0.22 $ perl -v This is perl, v5.10.0 built for x86_64-linux-gnu-thread-multi
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Moose and enum
by myffy (Acolyte) on May 29, 2008 at 10:18 UTC | |
by FunkyMonk (Bishop) on May 29, 2008 at 16:00 UTC |