[Catalyst] Manipulating CGI cookie via Catalyst

Gabriel Vieira gabriel.vieira at gmail.com
Tue May 27 20:05:46 BST 2008


You need to understand how Cookies are writed.
Thery are HTTP Headers, so you may be giving an outdated value and
next the system gives a update value. Javascript writes the Cookies
after HTTP process, so the system values are irrelevant to it.

Try to use the Catalyst structure to manipulate them instead of trying
to make some code.


On Tue, May 27, 2008 at 11:07 AM, Mitch Jackson <perimus at gmail.com> wrote:
>>     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
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>



-- 
Gabriel Vieira



More information about the Catalyst mailing list