[Catalyst] Create a PHP::Session

Octavian Rasnita orasnita at gmail.com
Sun Jul 18 14:32:12 GMT 2010


Hi,

I need to make a program that shares the sessions with another program which is made in PHP and I thought the easiest way would be to generate the session data on the server using PHP::Session.

The PHP session file names are of the form sess_po0nkrgqkjcbx7jb2z1ug17vwn.

I was able to create a CGI script that can share the session files with a PHP program, but I find it difficult to do it in a Catalyst app.

Please give me some hints about the modules/methods that should be subclassed.

I first thought that creating a Store plugin would be enough, but then I realised that I also need to generate the file names that have a special name. I tried to do it by using String::Random and overriding generate_session_id and validate_session_id from Catalyst::Plugin::Session but then I've seen that the app create a session file for each new request.

I tried to find out how C::P::S::Store::File works, but I couldn't find how Catalyst creates and then finds the file names of the session files.
I was sure that the value of the cookie, that SHA-1 signature is also the session ID and the name of the file, but I found that it is not true.
The session ID is stored in the session file but I don't know how to reach from the cookie value to the session ID (because I am sure Catalyst doesn't reads all the session files until it founds the good one).

Can you please tell me (or tell me where to look for) how the Cat app finds the file that holds the session data?

Thanks.

Octavian




More information about the Catalyst mailing list