You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by "Philip M. Gollucci" <pg...@p6m7g8.com> on 2006/01/03 02:17:57 UTC

Re: Apache2::Cookies - getting all names

 >Joe Sschaefer wrote:
 >-1.  We need to fix cookies(), not fetch().  Patch cookies()
 >so it actually works as documented.

If I'm reading the docs for Apache2::Cookie::Jar correctly, we don't 
have function that will get alls cookies as an array we just have these 
combos:

     $cookie = $j->cookies("foo");  # first foo cookie
     @cookies = $j->cookies("foo"); # all foo cookies
     @names = $j->cookies();        # all cookie names

If you add in Apache2::Cookie->fetch()

     my $cookies = Apache2::Cookie->fetch($r); #
     my %cookies = Apache2::Cookie->fetch($r);

Whats missing from that is

@cookies = $j->cookies() # all COOKIES (PERIOD)

which is really what I wish $j->cookies() would do instead of names.

I sort of agree with Jeff in that we should add

@names = $j->cookie_names() # all cookie names

in conjunction with the above.

I agree with not changing fetch().

And in fact, fetch would break down if you have multiple cookies of the 
same name?

..........






-- 
------------------------------------------------------------------------
"Love is not the one you can picture yourself marrying,
but the one you can't picture the rest of your life without."

"It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone..."

Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com


Re: Apache2::Cookies - getting all names

Posted by Joe Schaefer <jo...@sunstarsys.com>.
"Philip M. Gollucci" <pg...@p6m7g8.com> writes:

> If I'm reading the docs for Apache2::Cookie::Jar correctly, we don't have
> function that will get alls cookies as an array we just have these combos:
>
>     $cookie = $j->cookies("foo");  # first foo cookie
>     @cookies = $j->cookies("foo"); # all foo cookies
>     @names = $j->cookies();        # all cookie names
>
> If you add in Apache2::Cookie->fetch()
>
>     my $cookies = Apache2::Cookie->fetch($r); #
>     my %cookies = Apache2::Cookie->fetch($r);
>
> Whats missing from that is
>
> @cookies = $j->cookies() # all COOKIES (PERIOD)
>
> which is really what I wish $j->cookies() would do instead of names.

Me too, but that's not the point.  We need to carry 
over the pre-rename behavior of Apache::Cookie.

>
> I sort of agree with Jeff in that we should add
>
> @names = $j->cookie_names() # all cookie names
>
> in conjunction with the above.

But that's what @names = $j->cookies is for.  
The return list can't be both a list of names and a list of cookies,
and that API choice was made a long time ago.
It just needs to be fixed to match the docs.

-- 
Joe Schaefer