httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pgollu...@apache.org
Subject svn commit: r447770 - in /httpd/apreq/trunk/glue/perl: lib/Apache2/Cookie.pm t/apreq/cookie2.t t/response/TestApReq/cookie2.pm
Date Tue, 19 Sep 2006 07:33:42 GMT
Author: pgollucci
Date: Tue Sep 19 00:33:41 2006
New Revision: 447770

URL: http://svn.apache.org/viewvc?view=rev&rev=447770
Log:
Address the documentation / back compat concerns in
http://rt.cpan.org/Public/Bug/Display.html?id=20992

Discovered by: Derek R. Price <derek@ximbiot.com>
Reported by:   Dave Rolsky <autarch@urth.org>



Added:
    httpd/apreq/trunk/glue/perl/t/apreq/cookie2.t
    httpd/apreq/trunk/glue/perl/t/response/TestApReq/cookie2.pm
Modified:
    httpd/apreq/trunk/glue/perl/lib/Apache2/Cookie.pm

Modified: httpd/apreq/trunk/glue/perl/lib/Apache2/Cookie.pm
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/glue/perl/lib/Apache2/Cookie.pm?view=diff&rev=447770&r1=447769&r2=447770
==============================================================================
--- httpd/apreq/trunk/glue/perl/lib/Apache2/Cookie.pm (original)
+++ httpd/apreq/trunk/glue/perl/lib/Apache2/Cookie.pm Tue Sep 19 00:33:41 2006
@@ -483,7 +483,7 @@
 
 Changes to the 1.X API:
 
-=over 4
+=over 5
 
 =item * C<Apache2::Cookie::fetch> now expects an C<$r> object as (second)
         argument, although this isn't necessary in mod_perl 2 if
@@ -493,6 +493,9 @@
 =item * C<Apache2::Cookie::parse> is gone.
 
 =item * C<Apache2::Cookie::new> no longer encodes the supplied cookie name.
+
+=item * C<Apache2::Cookie::new()> returns undef if -value is not specified
+        or -value => undef.
 
 =item * C<name()> and C<value()> no longer accept a "set" argument. In other
words,
         neither a cookie's name, nor its value, may be modified.  A new cookie

Added: httpd/apreq/trunk/glue/perl/t/apreq/cookie2.t
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/glue/perl/t/apreq/cookie2.t?view=auto&rev=447770
==============================================================================
--- httpd/apreq/trunk/glue/perl/t/apreq/cookie2.t (added)
+++ httpd/apreq/trunk/glue/perl/t/apreq/cookie2.t Tue Sep 19 00:33:41 2006
@@ -0,0 +1,12 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+use Apache::TestRequest;
+
+my $module = 'TestApReq::cookie2';
+my $url    = Apache::TestRequest::module2url($module);
+
+t_debug "connecting to $url";
+print GET_BODY_ASSERT $url;

Added: httpd/apreq/trunk/glue/perl/t/response/TestApReq/cookie2.pm
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/glue/perl/t/response/TestApReq/cookie2.pm?view=auto&rev=447770
==============================================================================
--- httpd/apreq/trunk/glue/perl/t/response/TestApReq/cookie2.pm (added)
+++ httpd/apreq/trunk/glue/perl/t/response/TestApReq/cookie2.pm Tue Sep 19 00:33:41 2006
@@ -0,0 +1,70 @@
+package TestApReq::cookie2;
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+
+use Apache2::RequestRec ();
+
+use Apache2::Cookie ();
+
+sub handler {
+    my $r = shift;
+
+    plan $r, tests => 4;
+
+    {
+        my $cookie = Apache2::Cookie->new($r, name => 'n', value => undef);
+        ok t_cmp(
+                 $cookie,
+                 undef,
+                 "value => undef return undef not a cookie"
+				);
+    }
+
+    {
+        my $cookie = Apache2::Cookie->new($r, name => 'n');
+        ok t_cmp(
+                 $cookie,
+                 undef,
+                 "no value attribute specified"
+				);
+    }
+
+    {
+        my $cookie = Apache2::Cookie->new($r, name => 'n', value => '');
+        ok t_cmp(
+                 $cookie,
+                 "n=",
+                 "'' returns a valid cookie object"
+				);
+    }
+
+    {
+        my $cookie = Apache2::Cookie->new($r, name => 'n', value => []);
+        ok t_cmp(
+                 $cookie,
+                 "n=",
+                 "value => [] returns a valid cookie object"
+				);
+    }
+
+    {
+        my $cookie = Apache2::Cookie->new($r, name => 'n', value => {});
+        ok t_cmp(
+                 $cookie,
+                 "n=",
+                 "value => {} returns a valid cookie object"
+				);
+    }
+
+
+
+    return 0;
+}
+
+1;
+
+__END__



Mime
View raw message