in reply to Re^3: Cookie->fetch problem
in thread Cookie->fetch problem
I bet it was just the my $sessionname = 'CGISESSID';
When i run
I seemy %cookies = CGI::Cookie->fetch; print encode_entities(Dumper(\%cookies))."\n";
Remember im using TSSID rather than CGISESSID. So you are setting $sid to a hash reference that looks a whole lot like what i get when i run$VAR1 = { 'TSSID' => bless( { 'name' => 'TSSID', 'path' => '/', 'value' => [ '40d64ab47d37f6c7ae806dc11a +59f242' ] }, 'CGI::Cookie' ) };
ie:my $cookie2 = $q->cookie(TSSID => $session->id ); print encode_entities(Dumper($cookie2))."\n";
and that as $sid makes no sense if you ran$VAR1 = bless( { 'name' => 'TSSID', 'path' => '/', 'value' => [ '40d64ab47d37f6c7ae806dc11a59f242' ] }, 'CGI::Cookie' );
but does make sense if you instead ranmy $sessioncookie = new CGI::Cookie(-name=>$sname,-value=>$sid,-expire +s=>$session_cookie_timeout,-path=>'/cgi-bin',-domain=>$domain,-secure +=>1); print header(-Cookie=>[$sessioncookie],-type=>"text/html");
see if i runprint header(-Cookie=>[$sid],-type=>"text/html");
i get{ my $sname = 'CGISESSID'; my $cookie2 = $q->cookie(TSSID => $session->id ); my $sessioncookie = new CGI::Cookie(-name=>$sname,-value=>$cookie2,-pa +th=>'/cgi-bin'-secure=>1); print encode_entities(Dumper($sessioncookie))."\n"; }
and that just looks wrong.$VAR1 = bless( { 'name' => 'CGISESSID', 'path' => '/', 'value' => [ bless( { 'name' => 'TSSID', 'path' => '/', 'value' => [ '40d64ab47d37f6c7a +e806dc11a59f242' ] }, 'CGI::Cookie' ) ] }, 'CGI::Cookie' );
and note that if i run
i get backmy $sname=''; my $cookie3 = new CGI::Cookie(-name=>$sname,-value=>$session->id,-pa +th=>'/cgi-bin',-secure=>1); print encode_entities(Dumper($cookie3))."\n";
ie: a cookie with no name$VAR1 = bless( { 'name' => '', 'path' => '/cgi-bin', 'secure' => 1, 'value' => [ '40d64ab47d37f6c7ae806dc11a59f242' ] }, 'CGI::Cookie' );
|
|---|