From: John Napiorkowski Date: Thu, 11 Sep 2008 18:02:40 +0000 (+0000) Subject: removed debugging code, all tests are passing, added method to parse the type paramet... X-Git-Tag: 0.58~37^2~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bb6c833559f9e6ac403628d8ec4d09af2a0477e1;p=gitmo%2FMoose.git removed debugging code, all tests are passing, added method to parse the type parameter string --- diff --git a/lib/Moose/Meta/TypeConstraint/Parameterizable.pm b/lib/Moose/Meta/TypeConstraint/Parameterizable.pm index 93d0cc9..0dd7766 100644 --- a/lib/Moose/Meta/TypeConstraint/Parameterizable.pm +++ b/lib/Moose/Meta/TypeConstraint/Parameterizable.pm @@ -10,6 +10,7 @@ our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::TypeConstraint'; use Moose::Meta::TypeConstraint::Parameterized; +use Moose::Util::TypeConstraints (); __PACKAGE__->meta->add_attribute('constraint_generator' => ( accessor => 'constraint_generator', @@ -43,7 +44,7 @@ sub _can_coerce_constraint_from { sub parse_parameter_str { my ($self, $type_str) = @_; - return find_or_create_isa_type_constraint($type_str); + return Moose::Util::TypeConstraints::find_or_create_isa_type_constraint($type_str); } sub parameterize { diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index f8ccabe..c4cd826 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -142,12 +142,12 @@ sub _create_parameterized_type_constraint { my ($tc_name, $base_type_tc, $type_parameter_str) = @_; if($base_type_tc->can('parameterize')) { my @type_parameters_tc = $base_type_tc->parse_parameter_str($type_parameter_str); - return $base_type_tc->parameterize($tc_name,@type_parameters_tc); + return $base_type_tc->parameterize($tc_name, @type_parameters_tc); } else { return Moose::Meta::TypeConstraint::Parameterized->new( name => $tc_name, parent => $base_type_tc, - type_parameter => find_or_create_isa_type_constraint[$type_parameter_str], + type_parameter => find_or_create_isa_type_constraint($type_parameter_str), ); } } @@ -240,7 +240,7 @@ sub find_or_parse_type_constraint ($) { } else { return; } - + $REGISTRY->add_type_constraint($constraint); return $constraint; }