From: John Napiorkowski Date: Thu, 29 Oct 2015 15:22:19 +0000 (-0500) Subject: Merge branch '104-path_empty_brackets' of https://github.com/grim8634/catalyst-runtim... X-Git-Tag: 5.90102~3^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=161710a39409d2afd256463471b8014a1c69adf4;hp=-c Merge branch '104-path_empty_brackets' of https://github.com/grim8634/catalyst-runtime into grim8634-104-path_empty_brackets --- 161710a39409d2afd256463471b8014a1c69adf4 diff --combined lib/Catalyst/Action.pm index 3497e21,07f2f32..ea3e3e4 --- a/lib/Catalyst/Action.pm +++ b/lib/Catalyst/Action.pm @@@ -52,7 -52,9 +52,9 @@@ has number_of_args => if( ! exists $self->attributes->{Args} ) { # When 'Args' does not exist, that means we want 'any number of args'. return undef; - } elsif(!defined($self->attributes->{Args}[0])) { + } elsif( + !defined($self->attributes->{Args}[0]) || + $self->attributes->{Args}[0] eq '' ) { # When its 'Args' that internal cue for 'unlimited' return undef; } elsif( @@@ -105,7 -107,7 +107,7 @@@ has number_of_args_constraints => return 1; # Its a normal 1 arg type constraint. } } else { - # We need to loop thru and error on ref types. We don't allow a ref type + # We need to loop through and error on ref types. We don't allow a ref type # in the middle. my $total = 0; foreach my $tc( @{$self->args_constraints}) { @@@ -138,6 -140,7 +140,7 @@@ has args_constraints => return [] unless scalar(@arg_protos); return [] unless defined($arg_protos[0]); + return [] if ($arg_protos[0] eq '' && scalar(@arg_protos) == 1); # If there is only one arg and it looks like a number # we assume its 'classic' and the number is the number of @@@ -190,7 -193,7 +193,7 @@@ has number_of_captures_constraints => return 1; # Its a normal 1 arg type constraint. } } else { - # We need to loop thru and error on ref types. We don't allow a ref type + # We need to loop through and error on ref types. We don't allow a ref type # in the middle. my $total = 0; foreach my $tc( @{$self->captures_constraints}) { @@@ -266,7 -269,7 +269,7 @@@ sub resolve_type_constraint my @supers = $self->class->can('meta') ? map { $_->meta } $self->class->meta->superclasses : (); my @roles = $self->class->can('meta') ? $self->class->meta->calculate_all_roles : (); - # So look thru all the super and roles in order and return the + # So look through all the super and roles in order and return the # first type constraint found. We should probably find all matching # type constraints and try to do some sort of resolution. @@@ -523,7 -526,7 +526,7 @@@ Does the Args match or not =head2 resolve_type_constraint -Trys to find a type constraint if you have on on a type constrained method. +Tries to find a type constraint if you have on on a type constrained method. =head2 compare diff --combined lib/Catalyst/Controller.pm index b1a9bef,a5b400f..b50a2ff --- a/lib/Catalyst/Controller.pm +++ b/lib/Catalyst/Controller.pm @@@ -389,7 -389,7 +389,7 @@@ sub _parse_attrs # Parse out :Foo(bar) into Foo => bar etc (and arrayify) - if ( my ( $key, $value ) = ( $attr =~ /^(.*?)(?:\(\s*(.+?)\s*\))?$/ ) ) + if ( my ( $key, $value ) = ( $attr =~ /^(.*?)(?:\(\s*(.*?)\s*\))?$/ ) ) { if ( defined $value ) { @@@ -900,7 -900,7 +900,7 @@@ declared attributes you must quote them If you use 'reference' type constraints (such as ArrayRef[Int]) that have an unknown number of allowed matches, we set this the same way "Args" is. Please keep in mind -that actions with an undetermined number of args match at lower precidence than those +that actions with an undetermined number of args match at lower precedence than those with a fixed number. You may use reference types such as Tuple from L that allows you to fix the number of allowed args. For example Args(Tuple[Int,Int]) would be determined to be two args (or really the same as Args(Int,Int).) You may