- Added new _DISPATCH private action for dispatching
[catagits/Catalyst-Runtime.git] / lib / Catalyst / DispatchType / Index.pm
CommitLineData
bcccee4e 1package Catalyst::DispatchType::Index;
2
3use strict;
4use base qw/Catalyst::DispatchType/;
5
6=head1 NAME
7
8Catalyst::DispatchType::Index - Index DispatchType
9
10=head1 SYNOPSIS
11
12See 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
24sub match {
25 my ( $self, $c, $path ) = @_;
bcccee4e 26 return if @{ $c->req->args };
772ab8ae 27 my $result = @{ $c->get_action( 'index', $path ) || [] }[-1];
bcccee4e 28
29 # Find default on namespace or super
30 if ($result) {
31 $c->action( $result->[0] );
ba599d1c 32 $c->namespace( $result->[0]->namespace );
bcccee4e 33 $c->req->action('index');
34 $c->req->match( $c->req->path );
35 return 1;
36 }
37 return 0;
38}
39
40=back
41
42=head1 AUTHOR
43
44Sebastian Riedel, C<sri@cpan.org>
45
46=head1 COPYRIGHT
47
48This program is free software, you can redistribute it and/or modify it under
49the same terms as Perl itself.
50
51=cut
52
531;