Denzil Kruse wrote:
> Hi all,
> 
> I'm trying to clear a cookie using CGI::Cookies, and
> can't seem to do it :(
> 
> if ($clear_cookie eq 'yes') {
> 
>      my %cookies = fetch CGI::Cookie;
> 
>      print "getting cookie<br>";
> 
>      if ($cookies{'id'}) {
> 
>           print "clearing cookie<br>";
>           $cookies{'id'}->expires('-1s');
>           print "cleared cookie<br>";
>      }
> }
> 
> I'm getting the "cleard cookie" message, but it is
> still there.
> 
> Denzil
> 

To clear the cookie in the user's client (browser) you have to "set" the
cookie again by printing it in the response headers. You are only
setting the local expiration, to have that maintained across the rest of
the session you have to tell the browser about it, which is done by
passing it back as if you were setting it initially.

HTH,

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to