HTTP::Cookies cookie_jar %rest hash

Discussion in 'Perl Misc' started by bigDWK, Sep 29, 2004.

  1. bigDWK

    bigDWK Guest

    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?
     
    bigDWK, Sep 29, 2004
    #1
    1. Advertising

  2. bigDWK

    brian d foy Guest

    In article <>, bigDWK
    <> wrote:

    > 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().


    > }


    --
    brian d foy,
     
    brian d foy, Sep 29, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. _Who
    Replies:
    7
    Views:
    2,700
  2. rp
    Replies:
    1
    Views:
    544
    red floyd
    Nov 10, 2011
  3. DHH
    Replies:
    1
    Views:
    94
    Tom Copeland
    Jan 19, 2007
  4. Ed Howland

    rest-client headers or cookies

    Ed Howland, Dec 21, 2009, in forum: Ruby
    Replies:
    2
    Views:
    162
    Ed Howland
    Dec 22, 2009
  5. benny s.

    Cookies are not saved to cookie_jar

    benny s., Oct 27, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    131
    benny s.
    Oct 27, 2003
Loading...

Share This Page