Skip to content

Commit

Permalink
early hack for Type::Tiny support
Browse files Browse the repository at this point in the history
  • Loading branch information
dams committed Jun 3, 2013
1 parent 872141a commit d1eb0e3
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lib/Method/Signatures.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1212,20 +1212,18 @@ our %mutc;
# This is a helper function to initialize our %mutc variable.
sub _init_mutc
{
require Any::Moose;
Any::Moose->import('::Util::TypeConstraints');
require Type::Registry;
Type::Registry->import();

no strict 'refs';
my $class = any_moose('::Util::TypeConstraints');
# no strict 'refs';
my $class = 'Type::Registry';
$mutc{class} = $class;

$mutc{findit} = \&{ $class . '::find_or_parse_type_constraint' };
$mutc{pull} = \&{ $class . '::find_type_constraint' };
$mutc{make_class} = \&{ $class . '::class_type' };
$mutc{make_role} = \&{ $class . '::role_type' };
my $registry = $class->for_me;
$registry->add_types(-Standard);

$mutc{findit} = sub { $registry->lookup(@_) };

$mutc{isa_class} = $mutc{pull}->("ClassName");
$mutc{isa_role} = $mutc{pull}->("RoleName");
}

# This is a helper function to find (or create) the constraint we need for a given type. It would
Expand Down

0 comments on commit d1eb0e3

Please sign in to comment.