[thelist] Expiring a cookie

Anthony Baratta Anthony at Baratta.com
Fri Oct 26 20:55:08 CDT 2001

At 06:04 PM 10/26/2001, you wrote:
>A perl question.
>I have a cookie that I have set and am attempting to expire.
>The code below does not seem to work. Any help will be appreciated.
>$the_cookie = $co->cookie(-name => 'UserID', -value => "whatever", -expires
>=> '-1d');
>print $co->header(-type => "text/html", -expires => "-1d", -location =>
>$redi_logout, -cookie => $the_cookie);

Are you using CGI.pm?

Here's a snip from my code:

my $cookie = $input->cookie(-name=>"Foo",

print "HTTP/1.1 200 OK\n";
print $input->redirect(-cookie=>$cookie,

You might want to force at least the path. I know with IE, if it does not 
get the path it will not work right.
Anthony Baratta
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."

More information about the thelist mailing list