[Catalyst] Weird problem with Catalyst::Authentication, and redirects

Ben van Staveren benvanstaveren at gmail.com
Wed Jan 26 10:17:22 GMT 2011

Hi folks, I've been breaking my head over this one for the last 3 hours and I 
can't figure out what the hell is going on. I'm using Catalyst::Authentication 
to deal with authentication, as follows:

in Root.pm:

sub auto {
   my $self = shift;
   my $c = shift;

   if(!$c->user_exists) {
     warn "user does not exist\n";
     return 0;
   return 1;

sub index :Path Args(0) {
   my $self = shift;
   my $c = shift;

So far so good, but... when loading up without being logged in, this happens:

user does not exist
[info] *** Request 4 (0.037/s) [4201] [Wed Jan 26 17:07:35 2011] ***
[debug] "GET" request for "/" from ""
[debug] Path is "/"
[debug] Found sessionid "130f7df91fcd9ca31c59eaa9c24f52de63d0c185" in cookie
[debug] Restored session "130f7df91fcd9ca31c59eaa9c24f52de63d0c185"
[debug] Rendering template "index.tt2"
[debug] Redirecting to "/dashboard/"

Strangely enough, it seems that the c->res->redirect isn't taking for some 
reason, this used to work before, and suddenly stopped working. I've been 
trying to figure out what I've changed that would cause this, and I haven't 
touched any of the authentication bits at all.

If I am in fact logged in, c->res->redirect works exactly as advertised and 
will happily do the trick, except in this case where I have not logged in.

Any ideas? I'm about ready to shoot this project in the head :(

More information about the Catalyst mailing list