1 package Catalyst::DispatchType::Path;
4 use base qw/Catalyst::DispatchType/;
7 my ($self, $c, $path) = @_;
9 if ( my $action = $self->{paths}->{$path} ) {
10 $c->req->action($path);
11 $c->req->match($path);
13 $c->namespace($action->prefix);
21 my ( $self, $c, $action ) = @_;
23 my $attrs = $action->attributes;
26 foreach my $r (@{$attrs->{Path} || []}) {
27 unless ($r =~ m!^/!) { # It's a relative path
28 $r = $action->prefix."/$r";
33 if ($attrs->{Global} || $attrs->{Absolute}) {
34 push(@register, $action->name); # Register sub name against root
37 if ($attrs->{Local} || $attrs->{Relative}) {
38 push(@register, join('/', $action->prefix, $action->name));
39 # Register sub name as a relative path
42 foreach my $r (@register) {
44 $self->{paths}{$r} = $action;