From: Dave Rolsky Date: Fri, 15 Apr 2011 15:36:24 +0000 (-0500) Subject: Enum needs to check that the value is not a ref X-Git-Tag: 2.0100~71 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=883e299ed6375fe5c9d8df203f68bcc0f57d0641;p=gitmo%2FMoose.git Enum needs to check that the value is not a ref --- diff --git a/lib/Moose/Meta/TypeConstraint/Enum.pm b/lib/Moose/Meta/TypeConstraint/Enum.pm index 2a7beb7..10e7c1e 100644 --- a/lib/Moose/Meta/TypeConstraint/Enum.pm +++ b/lib/Moose/Meta/TypeConstraint/Enum.pm @@ -23,7 +23,8 @@ my $inliner = sub { $ENUMS{$name} ||= { map { $_ => 1 } @{ $self->values() } }; return - "defined $val && " . '$' + "defined $val" + . "&& ! ref $val" . '&& $' . __PACKAGE__ . '::ENUMS{' . B::perlstring($name)