Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Answer: How can I delete a cookie?

by Toxa (Novice)
on Dec 16, 2004 at 15:15 UTC ( #415369=categorized answer: print w/replies, xml ) Need Help??

Q&A > CGI programming > How can I delete a cookie? - Answer contributed by Toxa

Use "expires" or you can send the cookie again with a null value "";

Ex:

use CGI qw/:standard/; use CGI::Cookie; my %CookieVars = ( ISAUTH => $ActualCookieVars{ISAUTH}, USERNAME => $ActualCookieVars{USERNAME}, AUTHLEVEL => $ActualCookieVars{AUTHLEVEL}, MYNUMBER => "$mynumber" ); # set cookie to the user my $cookie1 = new CGI::Cookie( -name=>'Test', -value =>\%CookieVars, # var to be sent -expires=>'+1h', # time to expire -domain=>"teste.com", # domain -path=>'/', #option path -secure=>0 # no ssl );

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2020-09-20 01:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (117 votes). Check out past polls.

    Notices?