This partially reverts commits:
• "Args() wasn't being processed as unlimited number of args, due to…" (43b44b3)
• "Fixed :Path() empty brackets attribute not registering action. Fixes: #104" (dd6a9f2)
leaving the tests added by them for the Path() bug in GH #104 but
reverting the code changes.
The code changes caused Attribute() to parse equivalent to Attribute('')
instead of Attribute. The mistake was not noticed because Path, Path(),
and Path('') should all produce equivalent behaviour. However, the same
is not true of other attributes. For example, Args.
Parsing empty parens as undef rather than an empty string is the correct
solution. Empty strings are achieved explicitly with Attribute('').
Reverting these changes fixes the regression in the handling of Args(),
which started producing the following error at app startup under debug
mode:
Out of memory during list extend
at .../Catalyst/DispatchType/Chained.pm line 101.
The following commit will make the correct fix.
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]) ||
- $self->attributes->{Args}[0] eq '' ) {
+ } elsif(!defined($self->attributes->{Args}[0])) {
# When its 'Args' that internal cue for 'unlimited'
return undef;
} elsif(
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
# 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 ) {