[Catalyst] Manipulating CGI cookie via Catalyst

Mitch Jackson perimus at gmail.com
Tue May 27 15:07:32 BST 2008


>     delete @{ $c->session }{qw/__user/};
>     delete @{ $c->session }{qw/id/};
>     delete @{ $c->session }{qw/session/};

Catalyst::Plugin::Session provides a "delete_session" method
http://search.cpan.org/search?query=catalyst%3A%3Aplugin%3A%3Asession

>     $c->res->cookies
>         ->{id} = {
>             value => [],
>             expires => 0,
>         };
> But the cookies just keep appearing, no matter how many times I refresh my
> browser.  I think there is something wrong, but I just couldn't figure out
> where.

To ask a browser to forget a cookie, the expiry date must be specified
in the past.  Try setting expires to time()-86400.

If you continue to have problems, use Firebug
(http://addons.mozilla.org/firefox/addon/1843)  to view the http
headers and see the actual cookie headers received by the browser and
post those here as they are received by the browser.

Kind Regards,

/Mitchell K. Jackson



More information about the Catalyst mailing list