Permalink
Browse files

Port the gross hack for parsing type constraints to the latest P::M::…

…S version.
  • Loading branch information...
rafl committed Mar 4, 2009
1 parent 32dae8b commit b9c53f3f1124c9ef8d7548acf2a61ffc24f6e692
Showing with 6 additions and 7 deletions.
  1. +6 −7 lib/MooseX/Method/Signatures/Meta/Method.pm
@@ -161,19 +161,18 @@ sub _build__return_type_constraint {
my $parser = Parse::Method::Signatures->new(
input => $self->return_signature,
- );
-
- my @tc = $parser->tc(1);
- my $tc = Parse::Method::Signatures::TypeConstraint->new(
- data => $tc[0], str => $tc[1],
- tc_callback => sub {
+ type_constraint_callback => sub {
my ($tc, $name) = @_;
return has_available_type_export($self->package_name, $name)
|| $tc->find_registered_constraint($name);
},
);
- return Tuple[$tc->tc];
+ my $param = $parser->_param_typed({});
+ confess 'failed to parse return value type constraint'
+ unless exists $param->{type_constraints};
+
+ return Tuple[$param->{type_constraints}->tc];
}
sub _param_to_spec {

0 comments on commit b9c53f3

Please sign in to comment.