Okay I'm having a heck of a time getting a cookie to set in Internet Explorer (the problem seems to occur on any version). I'm using CGI.pm to call the CGI::Cookie routines and I read somewhere that older versions of CGI.pm didn't do cookies correctly on IE so I upgraded to the latest version. Anyway, I know I've gotten this to work before. This isn't the actual code I'm working with but it does the same thing and gives the same error. (domain names were changed to protect the innocent)
#!/usr/bin/perl use CGI; use strict; my $cgi = new CGI; my %foo = (key1=>"value1",key2=>"value2"); my %from_cookie = $cgi->cookie(-name=>'foo'); if(%from_cookie) { print "Content-type:text/html\n\n"; print "<html><body>\n"; foreach my $key(keys %from_cookie) { print "$key = [$from_cookie{$key}]<br>\n"; } print "</body></html>\n"; } else { my $cookie = $cgi->cookie( -name=>'foo', -value=>\%foo, -expires=>'+1h', -path=>'/', -domain=>'somedomain.com', ); print $cgi->header(-cookie=>$cookie); print "<html><body>I have set the cookie</body></html>\n"; } exit;
The program I'm working on uses the hash as the cookie as this one does, but I also tested this just passing a single value to the cookie and got the same result: The cookie sets and works just fine on Netscape and Mozilla but on IE it doesn't set. I know I'm probably doing something dumb :) but this one just has me stumped.
Thanks in advance
ChrisIn reply to Evil Cookies in IE by cfreak
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |