From: Yuval Kogman Date: Fri, 31 Oct 2008 06:03:59 +0000 (+0000) Subject: more create_child_type fixes (Role, Enum) X-Git-Tag: 0.61~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2fb4885ef74bc342a049b54d8b89a2eb40685248;p=gitmo%2FMoose.git more create_child_type fixes (Role, Enum) --- diff --git a/lib/Moose/Meta/TypeConstraint/Class.pm b/lib/Moose/Meta/TypeConstraint/Class.pm index ddb3500..97069b1 100644 --- a/lib/Moose/Meta/TypeConstraint/Class.pm +++ b/lib/Moose/Meta/TypeConstraint/Class.pm @@ -102,8 +102,8 @@ sub is_subtype_of { # attribute). This whole create_child_type thing needs some changing # though, probably making MMC->new a factory or something. sub create_child_type { - my ($self, %opts) = @_; - return Moose::Meta::TypeConstraint->new(%opts, parent => $self); + my ($self, @args) = @_; + return Moose::Meta::TypeConstraint->new(@args, parent => $self); } 1; diff --git a/lib/Moose/Meta/TypeConstraint/Enum.pm b/lib/Moose/Meta/TypeConstraint/Enum.pm index 4191c54..d16597a 100644 --- a/lib/Moose/Meta/TypeConstraint/Enum.pm +++ b/lib/Moose/Meta/TypeConstraint/Enum.pm @@ -67,6 +67,11 @@ sub _compile_hand_optimized_type_constraint { sub { defined($_[0]) && !ref($_[0]) && exists $values{$_[0]} }; } +sub create_child_type { + my ($self, @args) = @_; + return Moose::meta::TypeConstraint->new(@args, parent => $self); +} + 1; __END__ @@ -91,6 +96,8 @@ Moose::Meta::TypeConstraint::Enum - Type constraint for enumerated values. =item B +=item B + =back =head1 BUGS diff --git a/lib/Moose/Meta/TypeConstraint/Role.pm b/lib/Moose/Meta/TypeConstraint/Role.pm index a9d9607..09cd625 100644 --- a/lib/Moose/Meta/TypeConstraint/Role.pm +++ b/lib/Moose/Meta/TypeConstraint/Role.pm @@ -95,6 +95,11 @@ sub is_subtype_of { } } +sub create_child_type { + my ($self, @args) = @_; + return Moose::meta::TypeConstraint->new(@args, parent => $self); +} + 1; __END__ @@ -123,6 +128,8 @@ Moose::Meta::TypeConstraint::Role - Role/TypeConstraint parallel hierarchy =item B +=item B + =item B Return all the parent types, corresponding to the parent classes.