From: Tomas Doran Date: Mon, 3 Jun 2013 18:43:01 +0000 (+0100) Subject: Remove the / from pathparts we send to chained, make more tests pass X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=refs%2Fheads%2Fno_path_dispatch Remove the / from pathparts we send to chained, make more tests pass --- diff --git a/lib/Catalyst/Controller.pm b/lib/Catalyst/Controller.pm index afa3e3f..73c647f 100644 --- a/lib/Catalyst/Controller.pm +++ b/lib/Catalyst/Controller.pm @@ -458,9 +458,11 @@ sub _parse_Absolute_attr { shift->_parse_Global_attr(@_); } sub _parse_Local_attr { my ( $self, $c, $name, $value ) = @_; # _parse_attr will call _parse_Path_attr for us + $name = join( '/', $self->path_prefix($c), $name); + $name =~ s!^/!!; return ( 'Chained' => '/', - 'PathPart' => join( '/', $self->path_prefix($c), $name) + 'PathPart' => $name ); } @@ -469,24 +471,19 @@ sub _parse_Relative_attr { shift->_parse_Local_attr(@_); } sub _parse_Path_attr { my ( $self, $c, $name, $value ) = @_; $value = '' if !defined $value; - if ( $value =~ s!^/!! ) { - return ( - 'Chained' => '/', - 'PathPart' => $value - ); + if ( $value =~ m!^/! ) { } elsif ( length $value ) { - return ( - 'Chained' => '/', - 'PathPart' => join( '/', $self->path_prefix($c), $value ) - ); + $value = join( '/', $self->path_prefix($c), $value ) } else { - return ( - 'Chained' => '/', - 'PathPart' => $self->path_prefix($c) - ); + $value = $self->path_prefix($c) } + $value =~ s!^/!!; + return ( + 'Chained' => '/', + 'PathPart' => $value + ); } sub _parse_Chained_attr {