You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2005/05/25 18:32:16 UTC

svn commit: r178482 - in /httpd/apreq/trunk/glue/perl: t/response/TestAPI/cookie.pm t/response/TestAPI/param.pm xsbuilder/APR/Request/Cookie/Cookie.pod xsbuilder/APR/Request/Cookie/Cookie.xs xsbuilder/APR/Request/Param/Param.pod xsbuilder/APR/Request/Param/Param.xs

Author: joes
Date: Wed May 25 09:32:16 2005
New Revision: 178482

URL: http://svn.apache.org/viewcvs?rev=178482&view=rev
Log:
Change signature of cookie_class($set) and param_class($set)
to return the table instead of the old class.

 

Modified:
    httpd/apreq/trunk/glue/perl/t/response/TestAPI/cookie.pm
    httpd/apreq/trunk/glue/perl/t/response/TestAPI/param.pm
    httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.pod
    httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs
    httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pod
    httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs

Modified: httpd/apreq/trunk/glue/perl/t/response/TestAPI/cookie.pm
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/t/response/TestAPI/cookie.pm?rev=178482&r1=178481&r2=178482&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/t/response/TestAPI/cookie.pm (original)
+++ httpd/apreq/trunk/glue/perl/t/response/TestAPI/cookie.pm Wed May 25 09:32:16 2005
@@ -12,7 +12,7 @@
 
 sub handler {
     my $r = shift;
-    plan $r, tests => 30;
+    plan $r, tests => 31;
     $r->headers_in->{Cookie} = "foo=1;bar=2;foo=3;quux=4";
 
     my $req = APR::Request::Apache2->handle($r);
@@ -46,7 +46,7 @@
 
     ok t_cmp join(" ", $jar->get("foo")), "1 3", '$jar->get("foo")';
 
-    ok not defined $jar->cookie_class("APR::Request::Cookie");
+    ok $jar == $jar->cookie_class("APR::Request::Cookie");
     ok t_cmp $_->is_tainted, 1, "is tainted: $_" for values %$jar;
     $_->is_tainted(0) for values %$jar;
     ok t_cmp $_->is_tainted, 0, "not tainted: $_" for values %$jar;
@@ -54,7 +54,9 @@
     eval { $jar->cookie_class("APR::Request::Param") };
     ok t_cmp qr/^Usage/, $@, "Bad class name";
 
-    ok t_cmp $jar->cookie_class(__PACKAGE__), "APR::Request::Cookie", "class upgrade";
+
+    ok t_cmp $jar->cookie_class(), "APR::Request::Cookie", "old class";
+    ok t_cmp $jar->cookie_class(__PACKAGE__), $jar, "class upgrade";
     ok $jar->{foo}->isa(__PACKAGE__);
 
     return 0;

Modified: httpd/apreq/trunk/glue/perl/t/response/TestAPI/param.pm
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/t/response/TestAPI/param.pm?rev=178482&r1=178481&r2=178482&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/t/response/TestAPI/param.pm (original)
+++ httpd/apreq/trunk/glue/perl/t/response/TestAPI/param.pm Wed May 25 09:32:16 2005
@@ -46,7 +46,7 @@
 
     ok t_cmp join(" ", $args->get("foo")), "1 3", '$args->get("foo")';
 
-    ok not defined $args->param_class("APR::Request::Param");
+    ok $args == $args->param_class("APR::Request::Param");
     ok t_cmp $_->is_tainted, 1, "is tainted: $_" for values %$args;
     $_->is_tainted(0) for values %$args;
     ok t_cmp $_->is_tainted, 0, "not tainted: $_" for values %$args;
@@ -55,7 +55,8 @@
     eval { $args->param_class("APR::Request::Cookie") };
     ok t_cmp qr/^Usage/, $@, "Bad class name";
 
-    ok t_cmp $args->param_class(__PACKAGE__), "APR::Request::Param", "class upgrade";
+    ok t_cmp $jar->param_class(), "APR::Request::Param", "old class";
+    ok t_cmp $args->param_class(__PACKAGE__), $args, "class upgrade";
     ok $args->{foo}->isa(__PACKAGE__);
 
     return 0;

Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.pod
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.pod?rev=178482&r1=178481&r2=178482&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.pod (original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.pod Wed May 25 09:32:16 2005
@@ -314,7 +314,10 @@
 
 Get/set the class each table element is blessed into during a 
 L<get> or L<FETCH> call.  If defined, the class must be derived 
-from APR::Request::Cookie.
+from APR::Request::Cookie.  When called with set, it returns 
+the $table.  Otherwise it returns the name of the current class, 
+or undef if no cookie class is defined.
+
 
 
 =for example begin

Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs?rev=178482&r1=178481&r2=178482&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs (original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs Wed May 25 09:32:16 2005
@@ -278,7 +278,6 @@
     char *curclass = mg->mg_ptr;
 
   CODE:
-    RETVAL = (curclass == NULL) ? &PL_sv_undef : newSVpv(curclass, 0);
 
     if (items == 2) {
         if (!SvOK(subclass)) {
@@ -298,7 +297,11 @@
         }
         if (curclass != NULL)
             Safefree(curclass);
+
+        XSRETURN(1);
     }
+
+    RETVAL = (curclass == NULL) ? &PL_sv_undef : newSVpv(curclass, 0);
 
   OUTPUT:
     RETVAL

Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pod
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pod?rev=178482&r1=178481&r2=178482&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pod (original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pod Wed May 25 09:32:16 2005
@@ -42,6 +42,8 @@
 =end testing
 
 
+
+
 =head1 SYNOPSIS
 
 
@@ -64,6 +66,8 @@
   ok @uploads == 1;
 
 
+
+
 =head1 DESCRIPTION
 
 The C<< APR::Request::Param >> module provides base methods
@@ -278,7 +282,9 @@
 
 Get/set the class each table element is blessed into during a
 L<get> or L<FETCH> call.  If defined, the class must be derived
-from APR::Request::Param.
+from APR::Request::Param.  When called with $set, it returns
+the $table.  Otherwise it returns the name of the current class,
+or undef if no param class is defined.
 
 
 
@@ -294,6 +300,8 @@
 =head2 FETCH
 
     $table->FETCH($name)
+
+Same as get().
 
 
 

Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs?rev=178482&r1=178481&r2=178482&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs (original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs Wed May 25 09:32:16 2005
@@ -140,7 +140,6 @@
     char *curclass = mg->mg_ptr;
 
   CODE:
-    RETVAL = (curclass == NULL) ? &PL_sv_undef : newSVpv(curclass, 0);
 
     if (items == 2) {
         if (!SvOK(subclass)) {
@@ -157,10 +156,15 @@
             STRLEN len;
             mg->mg_ptr = savepv(SvPV(subclass, len));
             mg->mg_len = len;
+            
         }
         if (curclass != NULL)
             Safefree(curclass);
+
+        XSRETURN(1);
     }
+
+    RETVAL = (curclass == NULL) ? &PL_sv_undef : newSVpv(curclass, 0);
 
   OUTPUT:
     RETVAL