1 package Catalyst::DispatchType::Index;
6 extends 'Catalyst::DispatchType';
11 Catalyst::DispatchType::Index - Index DispatchType
21 =head2 $self->match( $c, $path )
23 Check if there's an index action for a given path, and set it up to use it
24 if there is; only matches a full URI - if $c->req->args is already set
25 this DispatchType is guaranteed not to match.
30 my ( $self, $c, $path ) = @_;
31 return if @{ $c->req->args };
32 my $result = $c->get_action( 'index', $path );
34 if ($result && $result->match($c)) {
36 $c->namespace( $result->namespace );
37 $c->req->action('index');
38 $c->req->match( $c->req->path );
44 =head2 $self->uri_for_action( $action, $captures )
46 get a URI part for an action; always returns undef is $captures is set
47 since index actions don't have captures
52 my ( $self, $action, $captures ) = @_;
54 return undef if @$captures;
56 return undef unless $action->name eq 'index';
58 return "/".$action->namespace;
63 Sebastian Riedel, C<sri@cpan.org>
67 This program is free software, you can redistribute it and/or modify it under
68 the same terms as Perl itself.
72 __PACKAGE__->meta->make_immutable;