On Tue, 10 Jul 2001, Stas Bekman wrote:

> OK I've finally wrapped my head around how things work at the server
> startup.
> 
> This [the patch at the bottom] is a crude proof of concept code for
> PerlModule.  Before I wrap it all nicely, please tell me if that's more or
> less how things should be done. This is my first take on adding a new
> feature for 2.0 at the C side :)

looks good, a few comments..
 
> Should I provide a test for things like PerlModule/PerlRequire or these
> are core features and they are supposed to work? If the test is a good
> thing, I suppose i should write some unique module and require it and not
> some widely available module. since it's possible that I pick some module
> that will be loaded from a different place in the startup code and then
> the test wouldn't prove that the functionality works properly (e.g.
> assuming that PerlRequire startup.pl loads some module via 'use' and then
> the test is not testing anything.

if you can put a test case together, that's always good.
 
> - In case of the module/file require failure, should only the warning be
> printed or should the process abort its execution?

abort.
 
> Another question is about a definition of how do we want PerlModule to
> work:
> 
> - load modules in the parent interpreter and let all children inherit from
>   it.
> - allow each vhost to have its own preloaded modules.
> - allow each interpteter pool have its own preloaded modules (which is
>   probably the same as the prev item, right?)

yeah, Perl{Module,Require} should be per-server.

> May be we need to have normal PerlModule, which loads into the base
> interpretor and have a second directive PerlLocalModule which allows to
> load the module only in the parent of the tipool?

no, PerlModule should just do the right thing.  outside of VirtualHosts,
they are loaded by the parent interpreter, inside VirtualHosts they are
loaded by that server's interpreter.
 
> also after I finish to clean up the PerlModule and move onto PerlRequire:
> 
> - shouldn't PerlRequire be just an alias for PerlModule? since apparently
> its implementation seem to be identical to PerlModule.

PerlRequire puts quotes around the value, since PerlRequire is a file,
whereas PerlModule is a bareword.
 
>  {
>      MP_dSCFG(s);
>      PerlInterpreter *perl;
> -    int status;
> -    char **argv;
> +    int status, i;
> +    char **argv, **entries;
>      int argc;
>  #ifndef USE_ITHREADS
>      modperl_cleanup_data_t *cdata;
> @@ -80,6 +80,14 @@
>                                modperl_shutdown, apr_pool_cleanup_null);
>  #endif
> 
> +    {
> +        dTHXa(perl);
> +        entries = (char **)scfg->PerlModule->elts;
> +        for(i = 0; i < scfg->PerlModule->nelts; i++)
> +            if (modperl_require_module(aTHX_ entries[i], TRUE) == FALSE)
> +                exit(1);
> +    }
> +

this stuff should be in its own function, probably in
modperl_config.c.  you're missing some braces and whitespace:
for (...) {
    if (...) {
    }
}

> +    MP_TRACE_d(MP_FUNC, "%s\n", arg);

> +    MP_TRACE_d(MP_FUNC, "%s\n", arg);

should be more that "%s\n" here.




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

Reply via email to