You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Derek R. Price" <de...@ximbiot.com> on 2006/09/18 18:09:00 UTC

Apache::Cookie -> Apache2::Cookie API Change?

Hello,

If this isn't the correct place to report this problem, please excuse
the noise and redirect me...

Apache::Cookie->new used to deal gracefully with an undefined -value
argument (like: "...new (-name => 'some_cookie', -value => undef,
...)"), at least when -expire was in the past ("-1D" in my tests).  It
would return a new cookie with an empty value which could be saved to
expire the old cookie.

Now, using the same Perl source with Apache2::Cookie->new, an undefined
value is returned instead of the new cookie.  At best, this appears to
be an API change and should be documented.  At worst it appears to be a
bug in libapreq2 that should be fixed.

The documentation for A2::C->new states that -value should be an
arrayref, hashref, or string, but it seems to me that either the
behavior in response to an undefined -value should be documented or
trapped internally and an error issued via Carp::croak() or whatever.

I discovered this using libapreq2 2.0.7.

Thanks,

Derek
-- 
Derek R. Price
CVS Solutions Architect
Get CVS support at Ximbiot <http://ximbiot.com>!
v: +1 248.835.1260
f: +1 248.835.1263
<ma...@ximbiot.com>


Re: Apache::Cookie -> Apache2::Cookie API Change?

Posted by Dave Rolsky <au...@urth.org>.
On Tue, 19 Sep 2006, Derek R. Price wrote:

> Philip M. Gollucci wrote:
>> http://svn.apache.org/viewvc?view=rev&rev=447770
>> How's that ?
>
> Looks good to me.  Dave?

Not as good as actually _being_ backwards compatible, but if it's 
documented I can't complain.


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/

Re: Apache::Cookie -> Apache2::Cookie API Change?

Posted by "Derek R. Price" <de...@ximbiot.com>.
Philip M. Gollucci wrote:
> http://svn.apache.org/viewvc?view=rev&rev=447770
> How's that ?

Looks good to me.  Dave?

Derek
-- 
Derek R. Price
CVS Solutions Architect
Get CVS support at Ximbiot <http://ximbiot.com>!
v: +1 248.835.1260
f: +1 248.835.1263
<ma...@ximbiot.com>


Re: Apache::Cookie -> Apache2::Cookie API Change?

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Derek R. Price wrote:
> Now, using the same Perl source with Apache2::Cookie->new, an undefined
> value is returned instead of the new cookie.  At best, this appears to
> be an API change and should be documented.  At worst it appears to be a
> bug in libapreq2 that should be fixed.
http://svn.apache.org/viewvc?view=rev&rev=447770
How's that ?

I agree back compat is good, but I can't change the API at this juncture or we break backcompat in the 2.x series
with itself.

my $cookie = Apache2::Cookie->new($r, name => 'n');
if ($cookie) {
}
These ifs would suddenly be executed.

> I discovered this using libapreq2 2.0.7.
2.08 is out :)


-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

"In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night."
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /
 / /|_/ / // /\ \/ /_/ / /__
/_/  /_/\_, /___/\___\_\___/
       <___/

Re: Apache::Cookie -> Apache2::Cookie API Change?

Posted by "Derek R. Price" <de...@ximbiot.com>.
This same problem occurs if I call A2::C->new without any value argument
("...new (-name => 'some_cookie', -expire => '-1D', -path => ...,
-secure => 0)"), though I didn't verify the A:C->new behavior with no
-value at all (only with -value => undef...).

Derek


Derek R. Price wrote:
> Hello,
> 
> If this isn't the correct place to report this problem, please excuse
> the noise and redirect me...
> 
> Apache::Cookie->new used to deal gracefully with an undefined -value
> argument (like: "...new (-name => 'some_cookie', -value => undef,
> ...)"), at least when -expire was in the past ("-1D" in my tests).  It
> would return a new cookie with an empty value which could be saved to
> expire the old cookie.
> 
> Now, using the same Perl source with Apache2::Cookie->new, an undefined
> value is returned instead of the new cookie.  At best, this appears to
> be an API change and should be documented.  At worst it appears to be a
> bug in libapreq2 that should be fixed.
> 
> The documentation for A2::C->new states that -value should be an
> arrayref, hashref, or string, but it seems to me that either the
> behavior in response to an undefined -value should be documented or
> trapped internally and an error issued via Carp::croak() or whatever.
> 
> I discovered this using libapreq2 2.0.7.
> 
> Thanks,
> 
> Derek


-- 
Derek R. Price
CVS Solutions Architect
Get CVS support at Ximbiot <http://ximbiot.com>!
v: +1 248.835.1260
f: +1 248.835.1263
<ma...@ximbiot.com>