[Catalyst] default template

Octavian Rasnita orasnita at gmail.com
Fri Dec 29 18:40:42 GMT 2006


Hi,

I often need to make external redirections like in the following case:

sub logout : Local {
my ($self, $c) = @_;
$c->logout;
$c->res->redirect($c->uri_for("/"));
}

When I access /user/logout for executing this subroutine, it prints the 
following error:

Coldn't render template "file error - user/logout: not found"

So I need to add a template in the stash in this subroutine, even though I 
don't want to use and print any template, but just do the redirect.

If I add before redirection:

$c->stash->{template} = "index.tt";

all works fine, but I guess something is not right in this code.

Isn't there a way to just stop everything and make the redirection, without 
executing the end action?

If it is not a way, isn't there a way to specify a default template that's 
used in these cases, for not needing to specify it manually every time?

I have seen that the order of the actions ran is:
/auto
/user/logout
/end
-> TranzactiiBursiere::View::TT->process

Thank you.

Octavian




More information about the Catalyst mailing list