cap wrote:
Well, here's what I have to do to get direct access to values from the
original cookie hash:

my $cookies = Apache::Cookie->fetch;
my %hash = defined $cookies->{'session'} ? $cookies->{'session'}->value :
undef;

Strange. Thanks for the lead.

That's a bogus code. Obviously you are running without warnings mode on. Add:


use warnings;

and you will see why it is bogus. Perhaps your cookie was always valid so you didn't notice it. Howerer:

perl -lwe '%h = undef'
Name "main::h" used only once: possible typo at -e line 1.
Odd number of elements in hash assignment at -e line 1.
Use of uninitialized value in list assignment at -e line 1.




-----Original Message-----
From: Perrin Harkins [mailto:[EMAIL PROTECTED]
Sent: Monday, June 02, 2003 2:41 PM
To: [EMAIL PROTECTED]
Cc: modperl
Subject: Re: Apache::Cookie


On Mon, 2003-06-02 at 09:05, cap wrote:


i have an application that uses CGI and sets the cookie values

as a hashref.


im then attempting to retreive the values with Apache::Cookie with:

$cookies = Apache::Cookie->fetch;

$ccokies is a hashref so i should be able to get the individual

values with:


$cookies->{uid};

right? however, this doesn't appear to work.

I see the problem. There is mistake in the Apache::Cookie documentation, but the correct way to do this is shown in the mod_perl guide: http://perl.apache.org/docs/1.0/guide/porting.html#Converting_to_us e_Apache_Perl_Modules

Change your last line to this:

my $uid = defined $cookies->{'uid'} ? $cookies->{'uid'}->value() :
undef;

- Perrin




--


__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com



Reply via email to