Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 16921 invoked from network); 24 Dec 2007 09:43:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Dec 2007 09:43:15 -0000 Received: (qmail 78402 invoked by uid 500); 24 Dec 2007 09:43:00 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 78382 invoked by uid 500); 24 Dec 2007 09:43:00 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 78371 invoked by uid 99); 24 Dec 2007 09:43:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Dec 2007 01:43:00 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [64.22.89.58] (HELO host.habitatlife.com) (64.22.89.58) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Dec 2007 09:42:37 +0000 Received: from c-24-14-24-20.hsd1.il.comcast.net ([24.14.24.20] helo=[192.168.110.4]) by host.habitatlife.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1J6jpb-0002O2-2z; Mon, 24 Dec 2007 03:42:43 -0600 In-Reply-To: <0A898C0B-E780-479C-93EA-048D4EDC4ACE@habitatlife.com> References: <476F7405.50209@kuicr.kyoto-u.ac.jp> <0A898C0B-E780-479C-93EA-048D4EDC4ACE@habitatlife.com> Mime-Version: 1.0 (Apple Message framework v753) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: modperl List Content-Transfer-Encoding: 7bit From: Boysenberry Payne Subject: Re: Cookie questions Date: Mon, 24 Dec 2007 03:42:36 -0600 To: Raymond Wan X-Mailer: Apple Mail (2.753) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.habitatlife.com X-AntiAbuse: Original Domain - perl.apache.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - habitatlife.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Checked: Checked by ClamAV on apache.org Oops, I forgot the some code: # to set $cookie = { -name => "foo", -value => "bar", -path => "/" }; my $data = []; push( @$cookie_data, Apache2::Cookie->new( $r, %{$cookie} ) ); foreach ( @$cookie_data ) { $_->bake( $r ); } # now to unset my $jar = Apache2::Cookie::Jar->new( $r ); my $cookies = $jar->cookies; if ( defined $cookies->{foo} ) { $cookie = { -name => "foo", -value => "bar", -path => "/", -expires => "0" }; push( @$cookie_data, Apache2::Cookie->new( $r, %{$cookie} ) ); foreach ( @$cookie_data ) { $_->bake( $r ); } } On Dec 24, 2007, at 3:29 AM, Boysenberry Payne wrote: > This is what I do: > > $cookie = { name => "foo", value => "bar" } > my $data = []; > push( @$data, Apache2::Cookie->new( $r, %{$cookie} ) ); > foreach ( @$data ) { > $_->bake( $r ); > } > > Hope it helps... > > -bop > > On Dec 24, 2007, at 2:55 AM, Raymond Wan wrote: > >> >> Hi all, >> >> Sorry, but I'm not entirely sure if this is relevant to modperl... >> >> I was wondering if it was possible to delete cookies. I read that >> using Javascript, cookies can be deleted by setting it to a time >> in the past. I'm not sure how to do it in Mason, though. I think >> I know how to get a cookie and also to set a new one and send it >> out. But, I don't know how to get an old cookie, change it, and >> send it back. Or even, get a cookie, *copy it*, send the copy >> back. What is stopping the browser from creating a second cookie >> with the same name? >> >> Also, I've seen various ways of setting cookies. For example, one >> using APR::Request::Cookie and another using Apache2::Cookie. >> Which should I use? I'm setting a cookie by doing: >> >> $r->err_headers_out->add ("Set-Cookie" => $cookie->as_string); >> >> where $cookie is of type APR::Request::Cookie. Is this strange? >> (I forgot what I read to come up with this...most other documents >> mention a "bake" method...) >> >> Ray >> >> >