1 package Catalyst::DispatchType::Default;
4 use base qw/Catalyst::DispatchType/;
8 Catalyst::DispatchType::Default - Default DispatchType
18 =head2 $self->match( $c, $path )
20 If path is empty (i.e. all path parts have been converted into args),
21 attempts to find a default for the namespace constructed from the args,
22 or the last inherited default otherwise and will match that.
24 If path is not empty, never matches since Default will only match if all
25 other possibilities have been exhausted.
30 my ( $self, $c, $path ) = @_;
31 return if $path =~ m!/!; # Not at root yet, wait for it ...
32 my $result = ( $c->get_actions( 'default', $c->req->path ) )[-1];
34 # Find default on namespace or super
35 if ($result && $result->match($c)) {
37 $c->namespace( $result->namespace );
38 $c->req->action('default');
40 # default methods receive the controller name as the first argument
41 unshift @{ $c->req->args }, $path if $path;
50 Catalyst Contributors, see Catalyst.pm
54 This program is free software, you can redistribute it and/or modify it under
55 the same terms as Perl itself.