[Catalyst] Session problem

Wijnand Wiersma wijnand at nedbsd.nl
Fri Jan 27 20:38:28 CET 2006


Wijnand Wiersma wrote:
> Yuval Kogman wrote:
>> Please paste full logs and a code snippet.
>>
>> If you can, try to create a standalone application that recreates
>> this problem.
>>   
> I will try to get it soon.
Ok, let's start slowly.
I just added a new app (tutorial ;-) ) and put this in my plugins line:
use Catalyst qw/-Debug Static::Simple Session
        Session::State::Cookie
        Session::Store::File/;

According to what I think a sessionid should be generated when I request 
a page, correct?
Well, it doesn't look like that:
$ script/tutorial_server.pl
[Fri Jan 27 20:31:51 2006] [catalyst] [debug] Debug messages enabled
[Fri Jan 27 20:31:51 2006] [catalyst] [debug] Loaded plugins:
.------------------------------------------------------------------------------.
| Catalyst::Plugin::Static::Simple 
0.13                                        |
| Catalyst::Plugin::Session 
0.05                                               |
| Catalyst::Plugin::Session::State::Cookie 
0.02                                |
| Catalyst::Plugin::Session::Store::File 
0.07                                  |
'------------------------------------------------------------------------------'

[Fri Jan 27 20:31:51 2006] [catalyst] [debug] Loaded dispatcher 
"Catalyst::Dispatcher"
[Fri Jan 27 20:31:51 2006] [catalyst] [debug] Loaded engine 
"Catalyst::Engine::HTTP"
[Fri Jan 27 20:31:51 2006] [catalyst] [debug] Found home 
"/home/wijnand/tutorial"
[Fri Jan 27 20:31:51 2006] [catalyst] [debug] Loaded Private actions:
.----------------------+----------------------------------------+--------------.
| Private              | Class                                  | 
Method       |
+----------------------+----------------------------------------+--------------+
| /default             | tutorial                               | 
default      |
'----------------------+----------------------------------------+--------------'

[Fri Jan 27 20:31:51 2006] [catalyst] [info] tutorial powered by 
Catalyst 5.63
You can connect to your server at http://server1.nedbsd.nl:3000
[Fri Jan 27 20:32:06 2006] [catalyst] [debug] 
**********************************
[Fri Jan 27 20:32:06 2006] [catalyst] [debug] * Request 1 (0.062/s) [27057]
[Fri Jan 27 20:32:06 2006] [catalyst] [debug] 
**********************************
[Fri Jan 27 20:32:06 2006] [catalyst] [debug] "GET" request for "" from 
"217.170.33.176"
[Fri Jan 27 20:32:06 2006] [catalyst] [info] Request took 0.065241s 
(15.328/s)
.------------------------------------------------------------------+-----------.
| Action                                                           | 
Time      |
+------------------------------------------------------------------+-----------+
| /default                                                         | 
0.002916s |
'------------------------------------------------------------------+-----------'

Ah, ok, you have to do something with that session actually, so I added 
$c->session->{test}='test'; to /default.
Wow, I get a sessionid now, and I see my browser has a cookie now. Nice, 
but maybe that should be mentioned in the docs, there is only session 
magic if you actually access $c->session.

I reload my page, I still have the same sessionid so the cookie is 
actually sent back like it should. Awesome.

But now I have to figure out why it doesn't work in my application, the 
sessionid is generated but I don't get any cookies :-(

Wijnand



More information about the Catalyst mailing list