X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FTypes%2FStructured.pm;h=67d3f4644a895a64b00fca4e3c64e7b8850d41f1;hb=78f559467710da345f5d08c2fea40da4d75ed8ee;hp=2bb42a0f7a359314689fa398e83692d2e95a6609;hpb=67be6b65eafdcc510a27f502aaad8070dc0674b3;p=gitmo%2FMooseX-Types-Structured.git diff --git a/lib/MooseX/Types/Structured.pm b/lib/MooseX/Types/Structured.pm index 2bb42a0..67d3f46 100644 --- a/lib/MooseX/Types/Structured.pm +++ b/lib/MooseX/Types/Structured.pm @@ -134,12 +134,13 @@ sub Tuple($) { } @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'), @@ -148,7 +149,13 @@ sub Dict($) { $_ => _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}, ); } @@ -169,8 +176,8 @@ sub _normalize_args { } 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) {