Commit | Line | Data |
b96f127f |
1 | package Catalyst::DispatchType::Default; |
2 | |
3 | use strict; |
4 | use base qw/Catalyst::DispatchType/; |
5 | |
6 | sub prepare_action { |
78d760bb |
7 | my ( $self, $c, $path ) = @_; |
8 | return if $path =~ m!/!; # Not at root yet, wait for it ... |
9 | my $result = @{ $c->get_action( 'default', $c->req->path, 1 ) || [] }[-1]; |
10 | |
11 | # Find default on namespace or super |
b96f127f |
12 | if ($result) { |
13 | $c->action( $result->[0] ); |
14 | $c->namespace( $c->req->path ); |
15 | $c->req->action('default'); |
16 | $c->req->match(''); |
22f3a8dd |
17 | return 1; |
b96f127f |
18 | } |
22f3a8dd |
19 | return 0; |
b96f127f |
20 | } |
21 | |
22 | 1; |