X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalystX%2FRoutes.pm;h=e7059a471dce778c0ecb38d20ed44cf2d9c4c5c4;hb=0f72bf19a2702b80c9e9302a6c46e44bd8dced68;hp=63f0d823a19fa669dd1d8a0c5b3a8bf1d9cfd73c;hpb=24eee4ae45dfa6b3d196a7d9ac3a51f3dc1a8cd8;p=catagits%2FCatalystX-Routes.git diff --git a/lib/CatalystX/Routes.pm b/lib/CatalystX/Routes.pm index 63f0d82..e7059a4 100644 --- a/lib/CatalystX/Routes.pm +++ b/lib/CatalystX/Routes.pm @@ -48,10 +48,15 @@ sub _add_route { $attrs->{Chained} = q{/}; } + my $name = $_[0]; + $name =~ s{^/}{}; + # We need to turn the full chain name into a path, since two end points # from two different chains could have the same end point name. - my $name = ( $attrs->{Chained} eq '/' ? q{} : $attrs->{Chained} ) . q{/} - . $_[0]; + $name = ( $attrs->{Chained} eq '/' ? q{} : $attrs->{Chained} ) . q{/} + . $name; + + $name =~ s{/}{|}g; my $meth_base = '__route__' . $name; @@ -75,6 +80,7 @@ sub _add_chain_point { my ( $attrs, $sub ) = _process_args( $meta, @_ ); my $name = $_[0]; + $name =~ s{/}{|}g; $meta->add_chain_point( $name => [ $attrs, $sub ] ); } @@ -216,7 +222,7 @@ __END__ => sub { ... }; # GET /user/foo - get 'foo' => sub { ... } + get 'foo' => sub { ... }; sub _post { ... } @@ -321,6 +327,9 @@ is essentially ignored (but still required). Note that it is legitimate to pass the empty string as the name for a chain's end point. +If the end point's name does not start with a slash, it will be prefixed with +the controller's namespace. + If you don't specify a C value for an end point, then it will use the root URI, C, as the root of the chain.