[Catalyst] Can't redirect using $c->res->redirect()

Emmanuel Quevillon tuco at pasteur.fr
Mon Nov 9 09:13:27 GMT 2009


Tomas Doran wrote:
> Emmanuel Quevillon wrote:
>> [Fri Nov  6 15:36:13 2009] [error] Caught exception in engine "Can't
>> call method "as_string" on an undefined value at
>> /usr/local/share/perl/5.10.0/Catalyst/Engine.pm line 95."
> 
> Can you start your server with perl -MDevel::SimpleTrace
> script/myapp_server.pl -d
> 
> and attach the full app startup, and the request which breaks (which
> should now include a full stack trace in its error).
> 
> Thanks.
> t0m
> 

Hi Tomas,

Here is the log generated :

[Mon Nov  9 10:08:03 2009] [info] [tuco,localhost,x,x] Logging out
[Mon Nov  9 10:08:03 2009] [debug] Deleting session(User logging out)
[Mon Nov  9 10:08:03 2009] [debug] Redirecting to
"http://localhost:3000/login"
[Mon Nov  9 10:08:03 2009] [error] Caught exception in engine "Can't
call method "as_string" on an undefined value
        at
Catalyst::Engine::finalize_cookies(/usr/local/share/perl/5.10.0/Catalyst/Engine.pm:95)
        at
Catalyst::finalize_cookies(/usr/local/share/perl/5.10.0/Catalyst.pm:1700)
        at
Catalyst::finalize_headers(/usr/local/share/perl/5.10.0/Catalyst.pm:1763)
        at
Catalyst::Plugin::Session::finalize_headers(/usr/local/share/perl/5.10.0/Catalyst/Plugin/Session.pm:99)
        at
Catalyst::finalize(/usr/local/share/perl/5.10.0/Catalyst.pm:1666)
        at
Catalyst::Plugin::FillInForm::finalize(/usr/local/share/perl/5.10.0/Catalyst/Plugin/FillInForm.pm:67)
        at
Catalyst::Plugin::Static::Simple::finalize(/usr/local/share/perl/5.10.0/Catalyst/Plugin/Static/Simple.pm:80)
        at <eval>(/usr/local/share/perl/5.10.0/Catalyst.pm:1829)
        at
Catalyst::handle_request(/usr/local/share/perl/5.10.0/Catalyst.pm:1819)
        at
Catalyst::Engine::HTTP::_handler(/usr/local/share/perl/5.10.0/Catalyst/Engine/HTTP.pm:394)
        at
Catalyst::Engine::HTTP::run(/usr/local/share/perl/5.10.0/Catalyst/Engine/HTTP.pm:291)
        at Catalyst::run(/usr/local/share/perl/5.10.0/Catalyst.pm:2121)
        at main::__ANON__(script/bibliolist_server.pl:68)
        at
Catalyst::Restarter::Forking::_fork_and_start(/usr/local/share/perl/5.10.0/Catalyst/Restarter/Forking.pm:20)
        at
Catalyst::Restarter::run_and_watch(/usr/local/share/perl/5.10.0/Catalyst/Restarter.pm:68)
        at main::(script/bibliolist_server.pl:104)"



Just to add a little more info, when on the blank page after
clicking 'Logout' button, if I do a 'reload' in my browser, I am
redirected to the login page as expected and this is the following
log generated :

[Mon Nov  9 10:08:31 2009] [info] *** Request 7 (0.135/s) [5954]
[Mon Nov  9 10:08:31 2009] ***
[Mon Nov  9 10:08:31 2009] [debug] "GET" request for "logout" from
"127.0.0.1"
[Mon Nov  9 10:08:31 2009] [debug] Path is "logout"
[Mon Nov  9 10:08:31 2009] [debug] Found sessionid
"fcd469f228156f819cf7d7ab3b8742ceaf444388" in cookie
[Mon Nov  9 10:08:31 2009] [debug] Deleting session(session expired)
[Mon Nov  9 10:08:31 2009] [debug] Redirecting to
"http://localhost:3000/login"
[Mon Nov  9 10:08:31 2009] [info] Request took 0.028152s (35.521/s)
.------------------------------------------------------------+-----------.
| Action                                                     | Time
     |
+------------------------------------------------------------+-----------+
| /auto                                                      |
0.006261s |
| /end                                                       |
0.000699s |
'------------------------------------------------------------+-----------'


[Mon Nov  9 10:08:31 2009] [info] *** Request 8 (0.154/s) [5954]
[Mon Nov  9 10:08:31 2009] ***
[Mon Nov  9 10:08:31 2009] [debug] "GET" request for "login" from
"127.0.0.1"
[Mon Nov  9 10:08:31 2009] [debug] Path is "login"
[Mon Nov  9 10:08:31 2009] [debug] Rendering template "login.tt2"
[Mon Nov  9 10:08:31 2009] [debug] Created session
"d3461d4598946c79a5a95e095672819fa6c09bef"
[Mon Nov  9 10:08:32 2009] [info] Request took 0.058135s (17.201/s)
.------------------------------------------------------------+-----------.
| Action                                                     | Time
     |
+------------------------------------------------------------+-----------+
| /auto                                                      |
0.001886s |
| /login/index                                               |
0.000486s |
| /end                                                       |
0.032852s |
|  -> BiblioList::View::TT->process                          |
0.030826s |
'------------------------------------------------------------+-----------'


Thanks for your time

Regards

Emmanuel

-- 
-------------------------
Emmanuel Quevillon
Biological Software and Databases Group
Institut Pasteur
+33 1 44 38 95 98
tuco at_ pasteur dot fr
-------------------------



More information about the Catalyst mailing list