in reply to Cookie Woes

I don't quite understand these questions but I have two comments that might be relevant. Please don't treat these as authoritative, though.

(1) did you define $sessionID somewhere else? If not, the script as will fail under strict, as well as your cookie being deficient.

(2) for some reason I don't understand, $badcookie seems to be a hash reference rather than a scalar.

Taking these together I get your script to run amended thus:
use strict; use CGI qw(:all); use CGI::Cookie; # insert definition of $sessionID: my $sessionID = "hello world"; my ($domain, $name, $value, $expires) = ('65.1.136.248', 'SessionID', +$sessionID, '+1Y'); my $cookieheader = new CGI::Cookie(-name => $name, -value => $value, -expires => $expires) || die; # left out domain so it wd work on my web space print header(-cookie=>$cookieheader); my $badcookie = fetch CGI::Cookie('SessionID'); # print $badcookie as hashref, not scalar: print $badcookie->{'SessionID'};


§ George Sherston

Replies are listed 'Best First'.
Re: Re: Cookie Woes
by vbrtrmn (Pilgrim) on Oct 22, 2001 at 09:56 UTC
    Okay, tried that.
    $sessionID is setup somewhere else.
    With your code, the cookie is created, but nothing is returned. Per cLive ;-), I put the cookie-recall sub into a different script. This will return the cookie once, but not again, after a reload. I have the same results in IE, Netscape 4.x, Netscape 6.x, and Mozilla 0.8.1.

    --
    paul