1 package Catalyst::DispatchType::Default;
4 extends 'Catalyst::DispatchType';
10 Catalyst::DispatchType::Default - Default DispatchType
20 =head2 $self->match( $c, $path )
22 If path is empty (i.e. all path parts have been converted into args),
23 attempts to find a default for the namespace constructed from the args,
24 or the last inherited default otherwise and will match that.
26 If path is not empty, never matches since Default will only match if all
27 other possibilities have been exhausted.
32 my ( $self, $c, $path ) = @_;
33 return if $path =~ m!/!; # Not at root yet, wait for it ...
34 my $result = ( $c->get_actions( 'default', $c->req->path ) )[-1];
36 # Find default on namespace or super
37 if ($result && $result->match($c)) {
39 $c->namespace( $result->namespace );
40 $c->req->action('default');
42 # default methods receive the controller name as the first argument
43 unshift @{ $c->req->args }, $path if $path;
52 Catalyst Contributors, see Catalyst.pm
56 This program is free software, you can redistribute it and/or modify it under
57 the same terms as Perl itself.
61 __PACKAGE__->meta->make_immutable;