good morning :)

the attached patch renames

  Apache2->request()

to

  Apache2::RequestUtil->request()

I chose RequestUtil over RequestRec because I kinda thought that RequestUtil
was more proper - request() is a helper method that doesn't work under all
circumstances (as opposed to a constructor that rightly belongs in
RequestRec).  but thoughts to the contrary welcome :)

anyway, I was going to do something similar with Apache2->server, placing it
it in Apache2::ServerUtil but I wanted to fly this by folks first.

--Geoff
Index: xs/maps/modperl_functions.map
===================================================================
--- xs/maps/modperl_functions.map	(revision 160402)
+++ xs/maps/modperl_functions.map	(working copy)
@@ -38,13 +38,14 @@
  mpxs_Apache2__RequestRec_location_merge
  mpxs_Apache2__RequestRec_set_basic_credentials
  mpxs_Apache2__RequestRec_no_cache | | r, flag=Nullsv
+
 PACKAGE=Apache2::RequestRec
  mpxs_Apache2__RequestRec_new | | classname, c, base_pool_sv=Nullsv
  SV *:DEFINE_dir_config | | request_rec *:r, char *:key=NULL, SV *:sv_val=Nullsv
  SV *:DEFINE_slurp_filename | | request_rec *:r, int:tainted=1
 
-PACKAGE=Apache2
- mpxs_Apache2_request | | classname, svr=Nullsv
+MODULE=Apache2::RequestUtil   PACKAGE=Apache2::RequestUtil
+ mpxs_Apache2__RequestUtil_request | | classname, svr=Nullsv
 
 MODULE=Apache2::RequestIO   PACKAGE=Apache2::RequestRec
  SV *:DEFINE_TIEHANDLE    | | SV *:stashsv, SV *:sv=Nullsv
Index: xs/Apache2/RequestUtil/Apache2__RequestUtil.h
===================================================================
--- xs/Apache2/RequestUtil/Apache2__RequestUtil.h	(revision 160401)
+++ xs/Apache2/RequestUtil/Apache2__RequestUtil.h	(working copy)
@@ -129,7 +129,7 @@
 }
 
 static MP_INLINE
-request_rec *mpxs_Apache2_request(pTHX_ SV *classname, SV *svr)
+request_rec *mpxs_Apache2__RequestUtil_request(pTHX_ SV *classname, SV *svr)
 {
     /* ignore classname */
     return modperl_global_request(aTHX_ svr);
Index: xs/tables/current/ModPerl/FunctionTable.pm
===================================================================
--- xs/tables/current/ModPerl/FunctionTable.pm	(revision 160401)
+++ xs/tables/current/ModPerl/FunctionTable.pm	(working copy)
@@ -7337,7 +7337,7 @@
   },
   {
     'return_type' => 'request_rec *',
-    'name' => 'mpxs_Apache2_request',
+    'name' => 'mpxs_Apache2__RequestUtil_request',
     'args' => [
       {
         'type' => 'PerlInterpreter *',
@@ -8098,3 +8098,3 @@
 
 
 1;
Index: t/response/TestCompat/conn_authen.pm
===================================================================
--- t/response/TestCompat/conn_authen.pm	(revision 160401)
+++ t/response/TestCompat/conn_authen.pm	(working copy)
@@ -4,7 +4,7 @@
 #   $r->connection->auth_type
 #   $r->connection->user
 # both records don't exist in 2.0 conn_rec and therefore require
-# 'PerlOptions +GlobalRequest' to retrieve those via Apache2->request
+# 'PerlOptions +GlobalRequest' to retrieve those via Apache2::RequestUtil->request
 
 use strict;
 use warnings FATAL => 'all';
Index: t/response/TestVhost/log.pm
===================================================================
--- t/response/TestVhost/log.pm	(revision 160401)
+++ t/response/TestVhost/log.pm	(working copy)
@@ -54,11 +54,11 @@
     }
 
     ### object-less logging
-    # set Apache2->request($r) instead of using
+    # set Apache2::RequestUtil->request($r) instead of using
     #   PerlOptions +GlobalRequest
     # in order to make sure that the above tests work fine,
     # w/o having the global request set
-    Apache2->request($r);
+    Apache2::RequestUtil->request($r);
     for my $m (@methods2) {
         eval "$m(q[$m])";
         ok t_cmp $logdiff->diff, qr/\Q$m/, $m;
Index: t/response/TestError/api.pm
===================================================================
--- t/response/TestError/api.pm	(revision 160401)
+++ t/response/TestError/api.pm	(working copy)
@@ -4,6 +4,7 @@
 use warnings FATAL => 'all';
 
 use Apache2::RequestRec ();
+use Apache2::RequestUtil ();
 use Apache2::RequestIO ();
 
 use Apache::Test;
@@ -19,7 +20,7 @@
     $r->content_type('text/plain');
 
     # PerlOptions -GlobalRequest is in effect
-    eval { my $gr = Apache2->request; };
+    eval { my $gr = Apache2::RequestUtil->request; };
     ok t_cmp($@, 
              qr/\$r object is not available/,
              "unavailable global $r object");
Index: t/response/TestAPI/request_rec.pm
===================================================================
--- t/response/TestAPI/request_rec.pm	(revision 160401)
+++ t/response/TestAPI/request_rec.pm	(working copy)
@@ -26,18 +26,18 @@
 
     plan $r, tests => 54;
 
-    #Apache2->request($r); #PerlOptions +GlobalRequest takes care
-    my $gr = Apache2->request;
+    #Apache2::RequestUtil->request($r); #PerlOptions +GlobalRequest takes care
+    my $gr = Apache2::RequestUtil->request;
 
     ok $$gr == $$r;
 
     my $newr = Apache2::RequestRec->new($r->connection, $r->pool);
-    Apache2->request($newr);
-    $gr = Apache2->request;
+    Apache2::RequestUtil->request($newr);
+    $gr = Apache2::RequestUtil->request;
 
     ok $$gr == $$newr;
 
-    Apache2->request($r);
+    Apache2::RequestUtil->request($r);
 
     ok $r->pool->isa('APR::Pool');
 
Index: t/response/TestAPI/request_subclass.pm
===================================================================
--- t/response/TestAPI/request_subclass.pm	(revision 160401)
+++ t/response/TestAPI/request_subclass.pm	(working copy)
@@ -4,6 +4,7 @@
 use warnings FATAL => 'all';
 
 use Apache2::RequestRec ();
+use Apache2::RequestUtil ();
 our @ISA = qw(Apache2::RequestRec);
 
 use Apache::Test;
@@ -24,7 +25,7 @@
 
     plan $r, tests => 5;
 
-    eval { my $gr = Apache2->request; };
+    eval { my $gr = Apache2::RequestUtil->request; };
     ok $@;
 
     ok $r->uri eq $location;
Index: t/response/TestAPI/aplog.pm
===================================================================
--- t/response/TestAPI/aplog.pm	(revision 160401)
+++ t/response/TestAPI/aplog.pm	(working copy)
@@ -186,15 +186,15 @@
         Apache2::ServerRec::warn("Apache2::ServerRec::warn test");
         ok t_cmp $logdiff->diff,
             qr/\[warn\] Apache2::ServerRec::warn test/,
-            'Apache2::ServerRec::warn() w/o Apache2->request ';
+            'Apache2::ServerRec::warn() w/o Apache2::RequestUtil->request ';
 
-        Apache2->request($r);
+        Apache2::RequestUtil->request($r);
         t_server_log_warn_is_expected();
         # this uses the global $r to get $s internally
         Apache2::ServerRec::warn("Apache2::ServerRec::warn test");
         ok t_cmp $logdiff->diff,
             qr/\[warn\] Apache2::ServerRec::warn test/,
-            'Apache2::ServerRec::warn() w/ Apache2->request ';
+            'Apache2::ServerRec::warn() w/ Apache2::RequestUtil->request ';
     }
 
     t_server_log_warn_is_expected();
Index: lib/Apache2/compat.pm
===================================================================
--- lib/Apache2/compat.pm	(revision 160401)
+++ lib/Apache2/compat.pm	(working copy)
@@ -281,7 +281,7 @@
 sub request {
     my $what = shift;
 
-    my $r = Apache2->request;
+    my $r = Apache2::RequestUtil->request;
 
     unless ($r) {
         die "cannot use $what ",
@@ -400,7 +400,7 @@
 sub httpd_conf {
     shift;
     my $obj;
-    eval { $obj = Apache2->request };
+    eval { $obj = Apache2::RequestUtil->request };
     $obj = Apache2->server if $@;
     my $err = $obj->add_config([split /\n/, join '', @_]);
     die $err if $err;
@@ -476,7 +476,7 @@
     $r->content_type($type);
 }
 
-#we support Apache2->request; this is needed to support $r->request
+#we support Apache2::RequestUtil->request; this is needed to support $r->request
 #XXX: seems sorta backwards
 *request = \&Apache2::request;
 
@@ -846,8 +846,8 @@
 
 # auth_type and user records don't exist in 2.0 conn_rec struct
 # 'PerlOptions +GlobalRequest' is required
-sub auth_type { shift; Apache2->request->ap_auth_type(@_) }
-sub user      { shift; Apache2->request->user(@_)      }
+sub auth_type { shift; Apache2::RequestUtil->request->ap_auth_type(@_) }
+sub user      { shift; Apache2::RequestUtil->request->user(@_)      }
 
 1;
 __END__

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to