made union tests skip for now, got start on fixing up the named type constraints
[gitmo/MooseX-Types-Structured.git] / lib / MooseX / Meta / TypeConstraint / Structured / Named.pm
index ee4b195..bcbc996 100644 (file)
@@ -95,6 +95,12 @@ sub constraint {
     my $self = shift;
     return sub {
         my %args = $self->_normalize_args(shift);
+        my @optional_signature;
+        
+        if($signature[-1]->isa('MooseX::Meta::TypeConstraint::Structured::Optional')) {
+            my $optional = pop @signature;
+            @optional_signature = @{$optional->signature};
+        }
         
         ## First make sure all the required type constraints match        
         foreach my $sig_key (keys %{$self->signature}) {