HTTP::Cookies cookie_jar %rest hash

B

bigDWK

From the HTTP::Cookies man page it shows this function

I believe I have the most current version of HTTP::Cookies (cpan tells
me I do).

$cookie_jar->scan( \&callback );
The argument is a subroutine that will be invoked for
each cookie stored in the $cookie_jar. The subroutine
will be invoked with the following arguments:

0 version
1 key
2 val
3 path
4 domain
5 port
6 path_spec
7 secure
8 expires
9 discard
10 hash

I can retrieve all this info, but i'm having problems getting the
values out of the hash that's returned. Here's my code


##########Code starts here, $c_jar has been filled with stuff from a
request###

$c_jar->scan(\&cookieCB);

sub cookieCB
{
my($ver, $keyC, $valC, $path, $domain, $port, $path_spec,
$secure, $maxage, $discard, %attr) = @_;

#then i do stuff with the values returned, all of these are
filled with values

#now to the hash

foreach my $key (keys(%attr))
{
print $key."\n";
}
}

##############End of Code###############3

The above code prints "HASH(0x[SomeHexNumber])" instead of the value
of the key. Of cource if I try and reference the value with this key
I get a blank value every time. Any ideas?
 
B

brian d foy

bigDWK said:
From the HTTP::Cookies man page it shows this function

$c_jar->scan(\&cookieCB);

sub cookieCB
{
my($ver, $keyC, $valC, $path, $domain, $port, $path_spec,
$secure, $maxage, $discard, %attr) = @_;

that last argument should be a scalar. HTTP::Cookies::scan is
going to call this function and give it an anonymous hash
as the last argument.

See the docs for HTTP::Cookies::set_cookie().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top