[Catalyst] tutorial problem : adding an auto action

phaylon phaylon at dunkelheit.at
Sun Mar 5 17:07:07 CET 2006


Daniel McBrearty wrote:

> sub auto : Private {
>     my ( $self, $c ) = @_;
>     if ( !$c->user ) {
>     $c->res->redirect( '/users/login' ); # require login
>     return 0; # abort request and go immediately to end()
>     }
>     return 1; # success; carry on to next action
> }

> 1. how to make the TT forwarding work without triggering an error if the
> body of the page is empty? This should be possible, right?

I'd recommend using the DefaultEnd plugin, which also checks
$c->response->status for you.

> 2. why I get this browser error about redirection limit, and how to fix it?

Your auto action redirects *every* access to /users/login, which
includes calls of /users/login. So a check for action or path should do
the trick.

hth, p



More information about the Catalyst mailing list