From: Dave Rolsky Date: Sun, 14 Sep 2008 21:46:04 +0000 (+0000) Subject: Yes, I know it's a string, that's why we're parsing it ;) X-Git-Tag: 0.58~37^2~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=98407b93cdb5af9d80e2460060627d3ad506eae7;p=gitmo%2FMoose.git Yes, I know it's a string, that's why we're parsing it ;) --- diff --git a/lib/Moose/Meta/TypeConstraint/Parameterizable.pm b/lib/Moose/Meta/TypeConstraint/Parameterizable.pm index 176e52f..e8d6891 100644 --- a/lib/Moose/Meta/TypeConstraint/Parameterizable.pm +++ b/lib/Moose/Meta/TypeConstraint/Parameterizable.pm @@ -42,9 +42,9 @@ sub _can_coerce_constraint_from { }; } -sub parse_parameter_str { - my ($self, $type_str) = @_; - return Moose::Util::TypeConstraints::find_or_create_isa_type_constraint($type_str); +sub parse_type_parameter { + my ($self, $type_parameter) = @_; + return Moose::Util::TypeConstraints::find_or_create_isa_type_constraint($type_parameter); } sub parameterize { diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index 9e07ab8..ff621af 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -117,16 +117,16 @@ sub create_type_constraint_union (@) { sub create_parameterized_type_constraint ($) { my $type_constraint_name = shift; - my ($base_type, $type_parameter_str) = _parse_parameterized_type_constraint($type_constraint_name); + my ($base_type, $type_parameter) = _parse_parameterized_type_constraint($type_constraint_name); - (defined $base_type && defined $type_parameter_str) + (defined $base_type && defined $type_parameter) || Moose->throw_error("Could not parse type name ($type_constraint_name) correctly"); if ($REGISTRY->has_type_constraint($base_type)) { my $base_type_tc = $REGISTRY->get_type_constraint($base_type); return _create_parameterized_type_constraint( $base_type_tc, - $type_parameter_str, + $type_parameter, ); } else { Moose->throw_error("Could not locate the base type ($base_type)"); @@ -134,18 +134,18 @@ sub create_parameterized_type_constraint ($) { } sub _create_parameterized_type_constraint { - my ( $base_type_tc, $type_parameter_str ) = @_; + my ( $base_type_tc, $type_parameter ) = @_; if ( $base_type_tc->can('parameterize') ) { my @type_parameters_tc - = $base_type_tc->parse_parameter_str($type_parameter_str); + = $base_type_tc->parse_type_parameter($type_parameter); return $base_type_tc->parameterize(@type_parameters_tc); } else { return Moose::Meta::TypeConstraint::Parameterized->new( - name => $base_type_tc->name . '[' . $type_parameter_str . ']', + name => $base_type_tc->name . '[' . $type_parameter . ']', parent => $base_type_tc, type_parameter => - find_or_create_isa_type_constraint($type_parameter_str), + find_or_create_isa_type_constraint($type_parameter), ); } }