Thanks for the idea.
However, it still does not work.
If I use the code that works for all browsers (to write the cookie),
then using
the CGI.PM method of reading the cookie still does not work.
If I use my, more manual, method of creating the cookie (which does NOT
work for
Safari), then using the CGI.PM method of reading the cookie DOES work.
<shrug>
Nice thought...
Thanks.
--Alex
Quoting Richard Morse <[EMAIL PROTECTED]>:
> On Jun 29, 2005, at 12:10 PM, Alex Brelsfoard wrote:
>
>> OK, so I've filed down my problem. I see where all my confusion has been
>> coming.
>> Of course I'm still left with one major problem.
>> First, here's the situation:
>>
>> When I use the following code I can write cookies everywhere but in Safari:
>> ----------------------------------------------
>> my $cookie = "$COOKIENAME=$cookieContent; " .
>> "domain=www.wpi.edu; " .
>> "expires=+1h";
>> print "Set-Cookie: $cookie\n";
>> ----------------------------------------------
>>
>> After that code I can retrieve the cookie by the following method:
>> ----------------------------------------------
>> my %cookies = fetch CGI::Cookie;
>> my $userInfo = $cookies{"WPI_REGI2500"}->value;
>> ----------------------------------------------
>>
>> Interesting fact, I cannot use this same code to read any other
>> random cookie I
>> see in my browser (testing with Firefox).
>>
>> OK, Now, my fixed code to be able to write cookies in any browser is
>> as follows:
>> ----------------------------------------------
>> my $cookie = $q->cookie( -name => $COOKIENAME,
>> -value => $cookieContent,
>> -domain => "www.wpi.edu",
>> -expires => "+1h",
>> -path => "/cgi-bin/Regi",
>> -secure => 1 );
>> print "Set-Cookie: $cookie\n";
>> ----------------------------------------------
>>
>> However, once I write the cookie this way, my cookie retrieval function no
>> longer works. I have verified that the cookie IS there. And it
>> looks exactly
>> the same as with the other code. But I simply can't read the cookie.
>> I have tried reading the cookie in several different ways, including reading
>> from $ENV{"HTTP_COOKIE"}, and doing both "fetch CGI::Cookie" and "parse
>> CGI::Cookie".
>> I MUST be reading in these cookies incorrectly in some way.
>> Can anyone help me, or point me in any helpful direction (other than
>> the pub)?
>>
>
> If you are using the OO interface to CGI.pm, the docs (`perldoc CGI`)
> say that you should do the following:
>
> Create a cookie using:
>
> my $cookie = $q->cookie(-name=>'name', -value=>'value' ...);
> print $q->header(-cookie=>$cookie);
>
> [read the docs for the specifics on this; you may need to pass other
> values to the cookie call, and there are ways to set multiple cookies]
>
> To retrieve the cookie, use the cookie() method _without_ setting a
> value:
>
> my $val = $q->cookie('name');
>
> Does this work?
>
> Ricky
>
>
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm