1 package Catalyst::DispatchType::Default;
4 extends 'Catalyst::DispatchType';
10 Catalyst::DispatchType::Default - Default DispatchType
14 See L<Catalyst::DispatchType>.
18 Dispatch type managing default behaviour. For more information on
23 =item * L<Catalyst::Manual::Intro> for how they affect application authors
25 =item * L<Catalyst::DispatchType> for implementation information.
31 =head2 $self->match( $c, $path )
33 If path is empty (i.e. all path parts have been converted into args),
34 attempts to find a default for the namespace constructed from the args,
35 or the last inherited default otherwise and will match that.
37 If path is not empty, never matches since Default will only match if all
38 other possibilities have been exhausted.
43 my ( $self, $c, $path ) = @_;
44 return if $path ne ''; # Not at root yet, wait for it ...
45 my $result = ( $c->get_actions( 'default', $c->req->path ) )[-1];
47 # Find default on namespace or super
48 if ($result && $result->match($c)) {
50 $c->namespace( $result->namespace );
51 $c->req->action('default');
53 # default methods receive the controller name as the first argument
54 unshift @{ $c->req->args }, $path if $path;
61 sub _is_low_precedence { 1 }
65 Catalyst Contributors, see Catalyst.pm
69 This library is free software. You can redistribute it and/or modify it under
70 the same terms as Perl itself.
74 __PACKAGE__->meta->make_immutable;