X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FMeta%2FTypeConstraint%2FStructured%2FNamed.pm;h=bcbc9962fdac1876dd3856082e450b7651484ede;hb=67be6b65eafdcc510a27f502aaad8070dc0674b3;hp=ee4b1954dd8c950a377e9d8119043cd13e7fe1a0;hpb=309c8a6c87e4d72793a68c005a5347edcccc3bde;p=gitmo%2FMooseX-Types-Structured.git diff --git a/lib/MooseX/Meta/TypeConstraint/Structured/Named.pm b/lib/MooseX/Meta/TypeConstraint/Structured/Named.pm index ee4b195..bcbc996 100644 --- a/lib/MooseX/Meta/TypeConstraint/Structured/Named.pm +++ b/lib/MooseX/Meta/TypeConstraint/Structured/Named.pm @@ -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}) {