1 package Catalyst::DispatchType::Index;
4 extends 'Catalyst::DispatchType';
9 Catalyst::DispatchType::Index - Index DispatchType
13 See L<Catalyst::DispatchType>.
17 Dispatch type managing behaviour for index pages. For more information on
22 =item * L<Catalyst::Manual::Intro> for how they affect application authors
24 =item * L<Catalyst::DispatchType> for implementation information.
30 =head2 $self->match( $c, $path )
32 Check if there's an index action for a given path, and set it up to use it
33 if there is; only matches a full URI - if $c->req->args is already set
34 this DispatchType is guaranteed not to match.
39 my ( $self, $c, $path ) = @_;
40 return if @{ $c->req->args };
41 my $result = $c->get_action( 'index', $path );
43 if ($result && $result->match($c)) {
45 $c->namespace( $result->namespace );
46 $c->req->action('index');
47 $c->req->match( $c->req->path );
53 =head2 $self->uri_for_action( $action, $captures )
55 get a URI part for an action; always returns undef is $captures is set
56 since index actions don't have captures
61 my ( $self, $action, $captures ) = @_;
63 return undef if @$captures;
65 return undef unless $action->name eq 'index';
67 return "/".$action->namespace;
72 Catalyst Contributors, see Catalyst.pm
76 This library is free software. You can redistribute it and/or modify it under
77 the same terms as Perl itself.
81 __PACKAGE__->meta->make_immutable;