On 2/20/07, Sumit Shah <[EMAIL PROTECTED]> wrote:
I printed out the contents of the Cookie attribute in the request header
and I can see the cookie present in the header. I read all the contents
into a hash and then try to check for its existence. The
if(exists($hashMap{'SSOTokenID'})) condition fails. Does it have
anything to do with data types?
No, Perl doesn't usually have those kinds of problems.
my $cookie = $r->headers_in->{'Cookie'};
my @cookieArray = split(";",$cookie);
my %hashMap;
my $cookieItem;
foreach $cookieItem (@cookieArray){
my @subArray = split("=",$cookieItem);
my $key = $subArray[0];
my $value = $subArray[1];
$hashMap{$key}=$value;
}
my $k;
my $v;
while ( ($k,$v) = each %hashMap ) {
$log->error("$k => $v");
}
What do you see log at this point? A simpler way to dump a hash is like this:
use Data::Dumper; warn Dumper(\%hashMap);
- Perrin