[Catalyst] cookies!

Toby Corkindale tjc at wintrmute.net
Wed Feb 13 00:04:04 GMT 2008


On Tue, Feb 12, 2008 at 03:44:44PM -0800, Jennifer Ahn wrote:
> hello!
>
> how does one implement cookies in catalyst?
>
> jennifer

You can access the cookie jar with:
$c->request->cookie('myCookie');
or
$c->request->cookies->{'myCookie'}->value;

To set cookies, use $c->response instead, like:
$c->response->cookies->{'newCookie'} = {
    value => '123',
    path => '/',
    domain => 'foobar.com',
    expires => '+8h',
    };

Toby



More information about the Catalyst mailing list