On Wed, 27 Sep 2000, Doug MacEachern wrote:

> On Tue, 26 Sep 2000, Salvador Ortiz Garcia wrote:
>  
> > IMHO the real problem relies in allow Perl{Module|Require} directives in
> > .htaccess files, The cls->PermModule and cls->PerlRequire arrays are both
> > in the per server part of mod_perl config, so allow to modify them (in
> > this case append to) when apache is parsing a .htaccess (a per request
> > operation to create a per directory config) simply don't make sense.
> 
> right, i realize that, and thought about also setting:
> cls->PerlRequire = cls->PerlModule = NULL;
> 
> after they are processed at startup, but decided to think about it more
> later.

Yes, your right, thats a better idea.

The 'push_array(cls->Perl...' in both cases can be put inside an else part
for the 'if(PERL_RUNNING()) {' to make clear that the process were
delayed.

btw, when i was making the patch, i realize that right now the inline
PerlRequire case (not PerlModule) is broken respect to processing
%ApacheReadConfig:: for PERL_SECTIONS, take a close look, right now it
reads:

           if(perl_load_startup_script(...)  != OK) {
                ... # Return $@
           }
           else {                 <---- OK, return
              return NULL;
           }

so the part 

    if(CAN_SELF_BOOT_SECTIONS)
        perl_section_self_boot(parms, dummy, arg);

isnt executed. (And executed in the delayed case, when not needed)

Full path attached.          
  
> 
> > BTW, I have a _very_ small and well tested patch for a new directive
> > 'PerlDo',
> > ...
>
> thanks salvador, that looks useful.  but, shouldn't it be called PerlEval?
> i would expect PerlDo to run 'do $arg'.  which might be a solution for
> people who expect something like PerlRequire in .htaccess to run the code
> in that file on every request.

Yes, PerlEval is much better, and with it they can say:

PerlEval do foo 

Returning to mod_perl hacking.

Salvador Ortiz

======== Cut =======
--- mod_perl-1.24.orig/src/modules/perl/perl_config.c   Fri May 12 20:14:40 2000
+++ mod_perl-1.24/src/modules/perl/perl_config.c        Wed Sep 27 20:32:09 2000
@@ -591,17 +592,17 @@
                dTHRCTX;
                return SvPV(ERRSV,n_a);
            }
-       }
-       else {
-           return NULL;
-       }
-    }
-    *(char **)push_array(cls->PerlModule) = pstrdup(parms->pool, arg);
-
 #ifdef PERL_SECTIONS
-    if(CAN_SELF_BOOT_SECTIONS)
-       perl_section_self_boot(parms, dummy, arg);
+           else {
+               if(CAN_SELF_BOOT_SECTIONS)
+                   perl_section_self_boot(parms, dummy, arg);
+           }
 #endif
+       }
+    } else {
+       /* Delay processing it until perl start */
+       *(char **)push_array(cls->PerlModule) = pstrdup(parms->pool, arg);
+    }
 
     return NULL;
 }
@@ -621,19 +622,18 @@
                dTHRCTX;
                return SvPV(ERRSV,n_a);
            }
+#ifdef PERL_SECTIONS
            else {
-               return NULL;
+               if(CAN_SELF_BOOT_SECTIONS)
+                   perl_section_self_boot(parms, dummy, arg);
            }
+#endif
        }
+    } else {
+       /* Delay processig it until perl start */
+       *(char **)push_array(cls->PerlRequire) = pstrdup(parms->pool, arg);
     }
 
-    *(char **)push_array(cls->PerlRequire) = pstrdup(parms->pool, arg);
-
-#ifdef PERL_SECTIONS
-    if(CAN_SELF_BOOT_SECTIONS)
-       perl_section_self_boot(parms, dummy, arg);
-#endif
-
     return NULL;
 }
 


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

Reply via email to