[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cgiapp] [cookies] Having problems getting info out of my cookie


John

The code I'm using is pretty much a cut and paste from the CGI perldoc page :


>    To retrieve a cookie, request it by name by calling cookie() method
>    without the -value parameter:
>
>            use CGI;
>            $query = new CGI;
>            $riddle = $query->cookie('riddle_name');
>            %answers = $query->cookie('answers');
>
>      Cookies created with a single scalar value, such as the "riddle_name"
>      cookie, will be returned in that form.  Cookies with array and hash
>      values can also be retrieved.

Since my cookie is defined as hash data :

my %cookie_data = (  name => 'blah',
                                            email => 'blahblah',
                                            ...
                                        );

my $cookie = new CGI::Cookie( -name    =>  'techweb',
                                                               -value   =>
\%cookie_values,
                                                               -expires =>
'+1h',
                                                 );

If I do

my %data = $query->cookie('techweb');

I can see the elements from my original hash as

$data{'name'}
$data{'email'}
$data{'...'}

This works fine.

Regards

Paul



*******************************************************************************
Important.
Confidentiality: This communication is intended for the above-named person and
may be confidential and/or legally privileged. Any opinions expressed in this
communication are not necessarily those of the company. If it has come to you
in error you must take no action based on it, nor must you copy or show it to
anyone; please delete/destroy and inform the sender immediately.

Monitoring/Viruses
Orange may monitor all incoming and outgoing emails in line with current
legislation.  Although we have taken steps to ensure that this email and
attachments are free from any virus, we advise that in keeping with good
computing practice the recipient should ensure they are actually virus free.

Orange PCS Limited is a subsidiary of Orange SA and is registered in England No
2178917, with its address at St James Court, Great Park Road, Almondsbury Park,
Bradley Stoke, Bristol BS32 4QJ.
*******************************************************************************


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.