1 package Catalyst::DispatchType::Default;
5 extends 'Catalyst::DispatchType';
11 Catalyst::DispatchType::Default - Default DispatchType
21 =head2 $self->match( $c, $path )
23 If path is empty (i.e. all path parts have been converted into args),
24 attempts to find a default for the namespace constructed from the args,
25 or the last inherited default otherwise and will match that.
27 If path is not empty, never matches since Default will only match if all
28 other possibilities have been exhausted.
33 my ( $self, $c, $path ) = @_;
34 return if $path =~ m!/!; # Not at root yet, wait for it ...
35 my $result = ( $c->get_actions( 'default', $c->req->path ) )[-1];
37 # Find default on namespace or super
38 if ($result && $result->match($c)) {
40 $c->namespace( $result->namespace );
41 $c->req->action('default');
43 # default methods receive the controller name as the first argument
44 unshift @{ $c->req->args }, $path if $path;
54 Sebastian Riedel, C<sri@cpan.org>
58 This program is free software, you can redistribute it and/or modify it under
59 the same terms as Perl itself.
63 __PACKAGE__->meta->make_immutable;