- Refactored get_action into get_action and get_actions
[catagits/Catalyst-Runtime.git] / lib / Catalyst / DispatchType / Index.pm
1 package Catalyst::DispatchType::Index;
2
3 use strict;
4 use base qw/Catalyst::DispatchType/;
5
6 =head1 NAME
7
8 Catalyst::DispatchType::Index - Index DispatchType
9
10 =head1 SYNOPSIS
11
12 See L<Catalyst>.
13
14 =head1 DESCRIPTION
15
16 =head1 METHODS
17
18 =over 4
19
20 =item $self->match( $c, $path )
21
22 =cut
23
24 sub match {
25     my ( $self, $c, $path ) = @_;
26     return if @{ $c->req->args };
27     my $result = $c->get_action( 'index', $path );
28
29     if ($result) {
30         $c->action( $result );
31         $c->namespace( $result->namespace );
32         $c->req->action('index');
33         $c->req->match( $c->req->path );
34         return 1;
35     }
36     return 0;
37 }
38
39 =back
40
41 =head1 AUTHOR
42
43 Sebastian Riedel, C<sri@cpan.org>
44
45 =head1 COPYRIGHT
46
47 This program is free software, you can redistribute it and/or modify it under
48 the same terms as Perl itself.
49
50 =cut
51
52 1;