1 package Catalyst::DispatchType::Index;
4 extends 'Catalyst::DispatchType';
9 Catalyst::DispatchType::Index - Index DispatchType
19 =head2 $self->match( $c, $path )
21 Check if there's an index action for a given path, and set it up to use it
22 if there is; only matches a full URI - if $c->req->args is already set
23 this DispatchType is guaranteed not to match.
28 my ( $self, $c, $path ) = @_;
29 return if @{ $c->req->args };
30 my $result = $c->get_action( 'index', $path );
32 if ($result && $result->match($c)) {
34 $c->namespace( $result->namespace );
35 $c->req->action('index');
36 $c->req->match( $c->req->path );
42 =head2 $self->uri_for_action( $action, $captures )
44 get a URI part for an action; always returns undef is $captures is set
45 since index actions don't have captures
50 my ( $self, $action, $captures ) = @_;
52 return undef if @$captures;
54 return undef unless $action->name eq 'index';
56 return "/".$action->namespace;
61 Catalyst Contributors, see Catalyst.pm
65 This program is free software, you can redistribute it and/or modify it under
66 the same terms as Perl itself.
70 __PACKAGE__->meta->make_immutable;