[Catalyst] Manipulating CGI cookie via Catalyst

sindharta_tanuwijaya at yahoo.co.jp sindharta_tanuwijaya at yahoo.co.jp
Mon May 26 12:10:14 BST 2008


Hi,

We are currently building an add-on for a site, which was built by using CGI, while the add-on is made by using Catalyst. 
Let's say that the sessions in the old site can be maintained by this simple PHP program.

<?php
setcookie("id", "sindharta", time() + 3600, "/", ".sin.my.office.com");
setcookie("session", "blablablablablabla", time() + 3600, "/", ".sin.my.office.com");
echo "cookies...\n";
print_r($_COOKIE);
echo "set!";
?>

As you probably know, that's to set the login id, and you'll notice that I am not using Catalyst::Plugin::Authentication. Now, in the new add-on, I want to have a logout button so that the user can log out directly too, but I am having difficulty in programming that.

I  have tried things such as:
--
    delete @{ $c->session }{qw/id/};
    $c->res->cookies
        ->{$cookie_name} = {
            value => [],
            expires => 0,
        };

    my $cookies = fetch CGI::Simple::Cookie;
    $cookies->{session}->value([]);
    $cookies->{id}->value([]);
--

But the cookie just won't disappear, it keeps coming back so that although I have pressed logout button, I am still considered as "login".
Any ideas what went wrong here ?

Sindharta

 

 
---------------------------------
GANBARE! NIPPON! Win your ticket to Olympic Games 2008.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20080526/6a98a11c/attachment.htm


More information about the Catalyst mailing list