[Catalyst] Manipulating CGI cookie via Catalyst

Mitch Jackson perimus at gmail.com
Tue Jun 3 15:04:55 BST 2008

On Mon, Jun 2, 2008 at 11:54 PM,  <sindharta_tanuwijaya at yahoo.co.jp> wrote:
> So does it mean that Javascript will regard different ports on the same
> domains as having the same domains while Catalyst apps will treat different
> ports as different domains ?

Cookies are not different depending on the programming language
(although some browsers will behave differently).  Cookies are just
pieces of text passed with HTTP headers.  Once you get how that works,
the feeling of 'cookies are this magic thing' goes away and you can
troubleshoot them easily.

In your javascript, you're setting your 'domain' field without a port
number.  In catalyst you are not specifying a domain field.  Have you
tried setting your domain field in catalyst the same way?

Learn to find what you're looking for by treasure hunting into the

The documentation of the cookies method for catalyst tells you it
handles cookie objects with CGI::Cookie.

If you look at the documentation for CGI::Cookie, you will see you can
set: name, value, expires, domain, path, httponly and secure

$c->response->cookies->{testcookie} = {
    value => 'iamatestcookiemonster'
    expires => time()-86400,
    domain => 'sin.my.office.com',
    path => '/',
    httponly => 0,
    secure => 0,

Kind Regards,

/Mitchell K. Jackson

More information about the Catalyst mailing list