hi all...

attached is the implementation of the PerlMapToStorageHandler. there's not much to it, since the majority of the code is autogenerated.

when I can put into words how the PerlTransHandler and PerlMapToStorageHandler are supposed to interact with eachother, and what their canonical roles are, I'll come up with some better tests. for the moment, though, stackedhandlers2 proves a few things:

- the PerlMapToStorageHandler runs
- it runs as RUN_FIRST
- it overrides the apache default (no more "Module bug?" errors when r->filename isn't set).


and I guess that's really all there is to this particular hook.

at any rate, I'll commit tomorrow unless somebody gripes, particularly the win32 guys in case I left out some required mapping someplace in xs/.

--Geoff
Index: lib/ModPerl/Code.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/lib/ModPerl/Code.pm,v
retrieving revision 1.109
diff -u -r1.109 Code.pm
--- lib/ModPerl/Code.pm 8 Oct 2003 13:28:14 -0000       1.109
+++ lib/ModPerl/Code.pm 13 Oct 2003 19:19:11 -0000
@@ -18,7 +18,7 @@
 my %handlers = (
     Process    => [qw(ChildInit ChildExit)], #Restart PreConfig
     Files      => [qw(OpenLogs PostConfig)],
-    PerSrv     => [qw(PostReadRequest Trans)],
+    PerSrv     => [qw(PostReadRequest Trans MapToStorage)],
     PerDir     => [qw(HeaderParser
                       Access Authen Authz
                       Type Fixup Response Log Cleanup
@@ -217,7 +217,7 @@
             my $ix = $self->{handler_index}->{$class}->[$i];
 
             if ($callback =~ m/modperl_callback_per_(dir|srv)/) {
-                if ($ix =~ m/AUTH|TYPE|TRANS/) {
+                if ($ix =~ m/AUTH|TYPE|TRANS|MAP/) {
                     $pass =~ s/MP_HOOK_RUN_ALL/MP_HOOK_RUN_FIRST/;
                 }
             }
Index: t/hooks/stacked_handlers2.t
===================================================================
RCS file: /home/cvspublic/modperl-2.0/t/hooks/stacked_handlers2.t,v
retrieving revision 1.1
diff -u -r1.1 stacked_handlers2.t
--- t/hooks/stacked_handlers2.t 11 Aug 2003 20:34:22 -0000      1.1
+++ t/hooks/stacked_handlers2.t 13 Oct 2003 19:19:11 -0000
@@ -20,6 +20,7 @@
 
 my $expected = q!ran 2 PerlPostReadRequestHandler handlers
 ran 1 PerlTransHandler handlers
+ran 1 PerlMapToStorageHandler handlers
 ran 4 PerlHeaderParserHandler handlers
 ran 2 PerlAccessHandler handlers
 ran 2 PerlAuthenHandler handlers
Index: t/hooks/TestHooks/stacked_handlers2.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/t/hooks/TestHooks/stacked_handlers2.pm,v
retrieving revision 1.2
diff -u -r1.2 stacked_handlers2.pm
--- t/hooks/TestHooks/stacked_handlers2.pm      11 Sep 2003 01:57:33 -0000      1.2
+++ t/hooks/TestHooks/stacked_handlers2.pm      13 Oct 2003 19:19:11 -0000
@@ -22,17 +22,6 @@
     return Apache::OK;
 }
 
-sub ok_fileset { 
-
-    my $r = shift;
-
-    $r->filename(__FILE__);
-
-    callback($r);
-
-    return Apache::OK;
-}
-
 sub declined { 
 
     callback(shift);
@@ -85,6 +74,7 @@
 
     foreach my $callback (qw(PerlPostReadRequestHandler
                              PerlTransHandler
+                             PerlMapToStorageHandler
                              PerlHeaderParserHandler 
                              PerlAccessHandler 
                              PerlAuthenHandler 
@@ -151,7 +141,10 @@
     PerlPostReadRequestHandler TestHooks::stacked_handlers2::ok 
TestHooks::stacked_handlers2::ok
 
     # 1 run, 1 left behind
-    PerlTransHandler TestHooks::stacked_handlers2::ok_fileset 
TestHooks::stacked_handlers2::server_error
+    PerlTransHandler TestHooks::stacked_handlers2::ok 
TestHooks::stacked_handlers2::server_error
+
+    # 1 run, 1 left behind
+    PerlMapToStorageHandler TestHooks::stacked_handlers2::ok 
TestHooks::stacked_handlers2::server_error
 
     <Location /TestHooks__stacked_handlers2>
         # all 4 run
Index: xs/tables/current/ModPerl/FunctionTable.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
retrieving revision 1.125
diff -u -r1.125 FunctionTable.pm
--- xs/tables/current/ModPerl/FunctionTable.pm  8 Oct 2003 13:28:14 -0000       1.125
+++ xs/tables/current/ModPerl/FunctionTable.pm  13 Oct 2003 19:19:16 -0000
@@ -3019,6 +3019,16 @@
     ]
   },
   {
+    'return_type' => 'int',
+    'name' => 'modperl_map_to_storage_handler',
+    'args' => [
+      {
+        'type' => 'request_rec *',
+        'name' => 'r'
+      }
+    ]
+  },
+  {
     'return_type' => 'void',
     'name' => 'modperl_mgv_append',
     'args' => [

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

Reply via email to