[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:
>Hello,
>
>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",
              -value=>'Fubar',
              -expires=>'+10y',
              -path=>'/',
              -domain=>'.foo.net',
              -secure=>0);

print "HTTP/1.1 200 OK\n";
print $input->redirect(-cookie=>$cookie,
              -uri=>"http://www.foo.net/");


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
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."





More information about the thelist mailing list