Initial support for :Args attribute
[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 =head2 $self->match( $c, $path )
19
20 =cut
21
22 sub match {
23     my ( $self, $c, $path ) = @_;
24     return if @{ $c->req->args };
25     my $result = $c->get_action( 'index', $path );
26
27     if ($result && $result->match($c)) {
28         $c->action($result);
29         $c->namespace( $result->namespace );
30         $c->req->action('index');
31         $c->req->match( $c->req->path );
32         return 1;
33     }
34     return 0;
35 }
36
37 =head1 AUTHOR
38
39 Sebastian Riedel, C<sri@cpan.org>
40
41 =head1 COPYRIGHT
42
43 This program is free software, you can redistribute it and/or modify it under
44 the same terms as Perl itself.
45
46 =cut
47
48 1;