1 package Catalyst::DispatchType::Path;
4 use base qw/Catalyst::DispatchType/;
8 Catalyst::DispatchType::Path - Path DispatchType
20 =item $self->match( $c, $path )
25 my ( $self, $c, $path ) = @_;
27 if ( my $action = $self->{paths}->{$path} ) {
28 $c->req->action($path);
29 $c->req->match($path);
31 $c->namespace( $action->prefix );
38 =item $self->register( $c, $action )
43 my ( $self, $c, $action ) = @_;
45 my $attrs = $action->attributes;
48 foreach my $r ( @{ $attrs->{Path} || [] } ) {
49 unless ( $r =~ m!^/! ) { # It's a relative path
50 $r = $action->prefix . "/$r";
52 push( @register, $r );
55 if ( $attrs->{Global} || $attrs->{Absolute} ) {
56 push( @register, $action->name ); # Register sub name against root
59 if ( $attrs->{Local} || $attrs->{Relative} ) {
60 push( @register, join( '/', $action->prefix, $action->name ) );
62 # Register sub name as a relative path
65 foreach my $r (@register) {
67 $self->{paths}{$r} = $action;
76 Sebastian Riedel, C<sri@cpan.org>
80 This program is free software, you can redistribute it and/or modify it under
81 the same terms as Perl itself.