Velocity Reviews

Velocity Reviews (
-   Perl Misc (
-   -   CGI::Cookie problem ( 04-12-2007 06:46 PM

CGI::Cookie problem
I am trying to get cookies working on a new site, but no luck.
The sites are on the same web server and so have a very similar
Apache setup. Then only difference worth noting is that the
working code is a and my new site where the code isn't
working is a Should that make a difference?

The thing that I believe is broken is fetching the cookie(s).

The part that sets the cookie is this:

my $cookie = setZoneCookie($login, $pswd, $login_type);
my $url=qq(/cgi-bin/new.cgi);
print $cgi->header( -cookie => $cookie );
# print $cgi->start_html(-head => meta( { -http_equiv=>"refresh", -
content=>"0;URL=$url" } ));
print qq(
<meta http-equiv="refresh" content="0;URL=$url">

and the cookie is set by:

our $COOKIEDOMAIN=$cgi->virtual_host();
sub setZoneCookie {
my ($login, $pswd, $area) = @_;
my ($cookie, $c_name, $dough);

$dough = "$login,$pswd";
$cookie = new CGI::Cookie(
-NAME => $cookie_names{$area},
-VALUE => $dough,
-EXPIRES => '+24h',
return $cookie;

I can see in debugging that the cookie looks right, just like any
other cookie:

xyz_cookie_staff=david%2Ciiikkk;; path=/;
expires=Fri, 13-
Apr-2007 18:28:57 GMT

The problem I think is fetching the cookie(s):

sub getLoginCookie {
my $area = shift;
my ($dough, @login);

%cookies = fetch CGI::Cookie;

if ($cookies{"xyz_cookie_staff"} ) {
$dough = $cookies{$cookie_names{$area}}->value;

# Dump
foreach my $x (sort keys %cookies) {
&daprint("dump - $x - $cookies{$x}");

The dump produces:

dump - CP - CP=%2A; path=/

I've tried clearing cookies IE-wide, and I've run and re-run the same
code on other sites with no problem. Any ideas?


All times are GMT. The time now is 11:37 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.