} @optional],
);
}
-
+use Data::Dump qw/dump/;
sub Dict($) {
my ($args, $optional) = _normalize_args(@_);
my %args = @$args;
my %optional = ref $optional eq 'ARRAY' ? @$optional : ();
+
return MooseX::Meta::TypeConstraint::Structured::Named->new(
name => 'Dict',
parent => find_type_constraint('HashRef'),
$_ => _normalize_type_constraint($args{$_});
} keys %args},
optional_signature => {map {
+
+ warn dump $_;
+ warn dump $optional{$_};
+ warn dump _normalize_type_constraint($optional{$_});
+
$_ => _normalize_type_constraint($optional{$_});
+
} keys %optional},
);
}
}
sub _normalize_type_constraint {
- my $tc = shift @_;
-
+ my ($tc) = @_;
+
## If incoming is an object, we will assume it's something that implements
## what a type constraint is. We should probably have a Role for this...
if(defined $tc && blessed $tc) {