[Catalyst] Manipulating CGI cookie via Catalyst

Gabriel Vieira gabriel.vieira at gmail.com
Mon May 26 16:36:27 BST 2008


The content changes? If yes, maybe you're updating the cookies after
the routine which should set it to a outdate value (the command you
just sended). If no, you are not accessing the right cookie.

On Mon, May 26, 2008 at 8:10 AM,  <sindharta_tanuwijaya at yahoo.co.jp> wrote:
> 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.
>
> _______________________________________________
> 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