Hi,
I'm having problem to make the cookie work. I'm not getting anything when I
call getCookie method
any help is appreciated
here is the code:
*************
##to send the cookie
my $cartId=$Response[0]->{id};
my $cookie1 = new CGI::Cookie(-name=>'ID',-value=>$cartId);
print $q->header();
print header(-cookie=>$cookie1);
**********************
##to get the cooke
my $cartId = getCartIdCookie();
sub getCookie() {
my (%cookies,$key,$value, %fields) = undef;
%cookies = fetch CGI::Cookie;
#$id = $cookies{'ID'}->value;
if (%cookies) {
foreach (keys %cookies) {
#print "line = ".$_;
($key,$value)=split(/=/);
$fields{$key}=$value;
#print "\n in getCookie key =".$key." and val =".$value;
}
if ($fields{cartId}) {
return %fields;
} else {
return undef
};
}