Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

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

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


tuco at pasteur

Nov 6, 2009, 6:43 AM

Post #1 of 5 (1057 views)
Permalink
Can't redirect using $c->res->redirect()

Hi,

I am facing a strange problem while redirecting to another url.
In my controller Logout::index, at the end,
$c->res->redirect($c->uri_for('/')); with previous version of catalyst.

Now, when I do it, I get stacked on a blank page en I get an error
in my logs :

[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."

The only way I found to get it working is to call
$c->detach(qw/Login index/) which check for a user connected or not
and so display login page or home page.

Has anybody a hint about this?

Thanks a lot

I am running Catalyst::Runtime 5.80013
--
-------------------------
Emmanuel Quevillon
Biological Software and Databases Group
Institut Pasteur
+33 1 44 38 95 98
tuco at_ pasteur dot fr
-------------------------

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


orasnita at gmail

Nov 6, 2009, 7:06 AM

Post #2 of 5 (996 views)
Permalink
Re: Can't redirect using $c->res->redirect() [In reply to]

From: "Emmanuel Quevillon" <tuco [at] pasteur>

> Hi,
>
> I am facing a strange problem while redirecting to another url.
> In my controller Logout::index, at the end,
> $c->res->redirect($c->uri_for('/')); with previous version of catalyst.
>
> Now, when I do it, I get stacked on a blank page en I get an error

I also had a similar problem, although I hadn't check the logs, and I solved
it by upgrading all the Catalyst related modules.

Try doing a

cpan -O > file

and then try to upgrade all the Catalyst:: modules and maybe a few others
that you may think it could help and see if this solves the problem.

Octavian


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


bobtfish at bobtfish

Nov 6, 2009, 8:14 AM

Post #3 of 5 (987 views)
Permalink
Re: Can't redirect using $c->res->redirect() [In reply to]

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


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


bobtfish at bobtfish

Nov 6, 2009, 8:17 AM

Post #4 of 5 (981 views)
Permalink
Re: Can't redirect using $c->res->redirect() [In reply to]

Octavian Râsnita wrote:
> and then try to upgrade all the Catalyst:: modules and maybe a few
> others that you may think it could help and see if this solves the problem.

Field Circus[1] solutions may work, but it'd be nice to know what the
root cause is..

At least if you start upgrading random things to see if they fix it,
please keep a note of what you try upgrading, and what versions it goes
from => to so that we get _some_ clues about where the breakage lies and
how to reproduce it?

Cheers
t0m

[1] http://www.jargon.net/jargonfile/f/fieldcircus.html

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


tuco at pasteur

Nov 9, 2009, 1:13 AM

Post #5 of 5 (938 views)
Permalink
Re: Can't redirect using $c->res->redirect() [In reply to]

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
-------------------------

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

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.