1 package Catalyst::DispatchType::Index;
5 extends 'Catalyst::DispatchType';
10 Catalyst::DispatchType::Index - Index DispatchType
20 =head2 $self->match( $c, $path )
22 Check if there's an index action for a given path, and set it up to use it
23 if there is; only matches a full URI - if $c->req->args is already set
24 this DispatchType is guaranteed not to match.
29 my ( $self, $c, $path ) = @_;
30 return if @{ $c->req->args };
31 my $result = $c->get_action( 'index', $path );
33 if ($result && $result->match($c)) {
35 $c->namespace( $result->namespace );
36 $c->req->action('index');
37 $c->req->match( $c->req->path );
43 =head2 $self->uri_for_action( $action, $captures )
45 get a URI part for an action; always returns undef is $captures is set
46 since index actions don't have captures
51 my ( $self, $action, $captures ) = @_;
53 return undef if @$captures;
55 return undef unless $action->name eq 'index';
57 return "/".$action->namespace;
62 Sebastian Riedel, C<sri@cpan.org>
66 This program is free software, you can redistribute it and/or modify it under
67 the same terms as Perl itself.
71 __PACKAGE__->meta->make_immutable;