[Catalyst] Create and store new cookie

Emmanuel Quevillon tuco at pasteur.fr
Mon Dec 17 16:46:27 GMT 2007


Hi list,

I would like to be able to create and store new cookie(s) 
for user display options for my application.
I am currently using C::P::Session::Store::Cooke to store 
the user session but I would like to add a new cookie.
I am trying by setting in one of my Controller sub a cookie 
like that:

$c->res->cookies->{my_options} = { foo => 1, bar => 2 };
$c->res->redirect($c->uri_for('some_url'));

If I dump $c->res I can see the cookie freshly created.
However if I come back to the options page later, I don't 
have this cookie anymore. I check with this :
unless($c->req->cookie($c->config->{my_cookie_name})){
	$c->log()->info("New cookie to create...");
}

Then I can see this message each time I go the options page.

Also, I can see that my session cookie 'myapp_session' is 
well stored but as a CGI::Simple::Cookie object, not a hash 
reference as mentioned in the response 'cookie' doc 
(http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7011/lib/Catalyst/Response.pm#$res-%3Ecookies)

Does anyone has a clue about this?
Does the redirect causes the reset of the cookies?

Thanks a lot

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