1 package Catalyst::DispatchType::Index;
4 use base qw/Catalyst::DispatchType/;
8 Catalyst::DispatchType::Index - Index DispatchType
18 =head2 $self->match( $c, $path )
20 Check if there's an index action for a given path, and set it up to use it
21 if there is; only matches a full URI - if $c->req->args is already set
22 this DispatchType is guaranteed not to match.
27 my ( $self, $c, $path ) = @_;
28 return if @{ $c->req->args };
29 my $result = $c->get_action( 'index', $path );
31 if ($result && $result->match($c)) {
33 $c->namespace( $result->namespace );
34 $c->req->action('index');
35 $c->req->match( $c->req->path );
41 =head2 $self->uri_for_action( $action, $captures )
43 get a URI part for an action; always returns undef is $captures is set
44 since index actions don't have captures
49 my ( $self, $action, $captures ) = @_;
51 return undef if @$captures;
53 return undef unless $action->name eq 'index';
55 return "/".$action->namespace;
60 Catalyst Contributors, see Catalyst.pm
64 This program is free software, you can redistribute it and/or modify it under
65 the same terms as Perl itself.