I'd rather split one application into several (admin app, survey app,
etc) and "join" its via middleware.

But you can try this:

In MyApp::Admin:
sub default : Path('admin') {
# or
# sub default : Chained(base) PathPart('') Path {
    my ( $self, $c ) = @_;
    $c->response->body( 'Page not found in /admin/...' );
    $c->response->status(404);
}


In MyApp::Survey;
sub default : Path('survey') {
# or
# sub default : Chained(base) PathPart('') Path {
    my ( $self, $c ) = @_;
    $c->response->body( 'Page not found in /survey/...' );
    $c->response->status(404);
}

On 7 February 2015 at 01:51, Trevor Leffler <tleff...@uw.edu> wrote:
> Some of my top-level controllers represent different, er... "major pieces"
> of my application.  They have, among other things, different default views,
> which are mainly just for configuring different page wrappers.  These
> controllers have this action pattern:
>
> package MyApp::Admin;
> sub base : Chained('/') : PathPart('admin') : CaptureArgs(0) { ... }
> sub index : Chained('base') : PathPart('') : Args(0) { ... }
>
> package MyApp::Survey;
> sub base : Chained('/') : PathPart('survey') : CaptureArgs(0) { ... }
> ...etc...
>
> Requests for non-extant paths fall through to Root->default(), which gives
> the (undesired) default root view.  I tried giving my top-level controllers
> their own default() methods, but as others have found [1], 'default() :
> Path' has precedence over 'index : Chained'.  Otherwise, I get the
> appropriate view with 'Page Not Found' content for bad urls, e.g.
> /admin/blargh or /survey/123/nurgle
>
> I am looking for suggestions/solutions to get the desired behavior.
>
> Changing index() to 'index : Path' is not a viable option.
>
>
> Thanks,
> --Trevor
>
> [1] http://www.gossamer-threads.com/lists/catalyst/users/24883
>
> _______________________________________________
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/



-- 
//wbr, Dmitry L.

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to