X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FTypeConstraint%2FEnum.pm;h=5f4e761aeddf36c8e72b3c673f88f0c9128601ee;hb=baf46b9edc7dc3665c7eaf9d1684b157efb09e1a;hp=d16597a485898bb5cd215852bd1883d5ee50ed43;hpb=2fb4885ef74bc342a049b54d8b89a2eb40685248;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/TypeConstraint/Enum.pm b/lib/Moose/Meta/TypeConstraint/Enum.pm index d16597a..5f4e761 100644 --- a/lib/Moose/Meta/TypeConstraint/Enum.pm +++ b/lib/Moose/Meta/TypeConstraint/Enum.pm @@ -6,7 +6,7 @@ use metaclass; use Moose::Util::TypeConstraints (); -our $VERSION = '0.60'; +our $VERSION = '0.72_01'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -69,7 +69,7 @@ sub _compile_hand_optimized_type_constraint { sub create_child_type { my ($self, @args) = @_; - return Moose::meta::TypeConstraint->new(@args, parent => $self); + return Moose::Meta::TypeConstraint->new(@args, parent => $self); } 1; @@ -82,21 +82,45 @@ __END__ Moose::Meta::TypeConstraint::Enum - Type constraint for enumerated values. +=head1 DESCRIPTION + +This class represents type constraints based on an enumerated list of +acceptable values. + +=head1 INHERITANCE + +C is a subclass of +L. + =head1 METHODS =over 4 -=item B +=item B<< Moose::Meta::TypeConstraint::Enum->new(%options) >> + +This creates a new class type constraint based on the given +C<%options>. + +It takes the same options as its parent, with several +exceptions. First, it requires an additional option, C. This +should be an array reference containing a list of valid string +values. Second, it automatically sets the parent to the C type. + +Finally, it ignores any provided C option. The constraint +is generated automatically based on the provided C -=item B +=item B<< $constraint->values >> -=item B +Returns the array reference of acceptable values provided to the +constructor. -=item B +=item B<< $constraint->create_child_type >> -=item B +This returns a new L object with the type +as its parent. -=item B +Note that it does I return a C +object! =back @@ -112,7 +136,7 @@ Yuval Kogman Enothingmuch@cpan.orgE =head1 COPYRIGHT AND LICENSE -Copyright 2006-2008 by Infinity Interactive, Inc. +Copyright 2006-2009 by Infinity Interactive, Inc. L