我使用的是Firefox 3.6.10(OS X Intel),浏览器会收集新的Cookie,而不是过期(“删除”)旧的Cookie。
这些cookie是通过Perl的CGI
和CGI::Cookie
模块创建和添加的。
我正在创建并添加cookie,如下所示:
my $myNewCookie = new CGI::Cookie(-name => "$myCookieName",
-value => { 'key1' => $value1, 'key2' => $value2 },
-expires => '+8h',
-secure => 1
);
print redirect(-URL => "$hostURL$redirect",
-cookie => $myNewCookie);
以下是我试图让它们过期的方法:
sub clearCookie {
my $myOldCookie = cookie(-name => "$myCookieName",
-value => '',
-expires => '-1d',
-secure => 1);
print header(-cookie=>$myOldCookie);
# ...
}
以下是发生的事情:
我可以继续前进,Firefox只会积累更多的cookie,而不会使任何一个过期。
我的脚本在当前版本的Google Chrome和Apple Safari下运行,但Firefox似乎不合作。
是否有我缺少的设置,这会正确告诉Firefox调整我的Cookie的到期日期?
感谢您的建议。