perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <>
Subject Re: cvs commit: modperl-2.0/todo release
Date Sat, 07 Aug 2004 20:32:10 GMT
Stas Bekman wrote:

> Philippe M. Chiasson wrote:
>> Stas Bekman wrote:
>>> wrote:
>>>> gozer       2004/08/06 19:52:08
>>>>    static const command_rec modperl_cmds[] = {         
>>>> MP_CMD_SRV_ITERATE("PerlSwitches", switches, "Perl Switches"),
>>>>   -    MP_CMD_SRV_ITERATE("PerlModule", modules, "PerlModule"),
>>>>   -    MP_CMD_SRV_ITERATE("PerlRequire", requires, "PerlRequire"),
>>>>   +    MP_CMD_DIR_ITERATE("PerlModule", modules, "PerlModule"),
>>>>   +    MP_CMD_DIR_ITERATE("PerlRequire", requires, "PerlRequire"),
>>>>        MP_CMD_DIR_ITERATE("PerlOptions", options, "Perl Options"),
>>>>        MP_CMD_DIR_ITERATE("PerlInitHandler", init_handlers, 
>>>> "Subroutine name"),
>>>>        MP_CMD_DIR_TAKE2("PerlSetVar", set_var, "PerlSetVar"),
>>>>        MP_CMD_DIR_ITERATE2("PerlAddVar", add_var, "PerlAddVar"),
>>>>        MP_CMD_DIR_TAKE2("PerlSetEnv", set_env, "PerlSetEnv"),
>>>>        MP_CMD_SRV_TAKE1("PerlPassEnv", pass_env, "PerlPassEnv"),
>>>>   -    MP_CMD_SRV_RAW_ARGS_ON_READ("<Perl", perl, "Perl Code"),
>>>>   -    MP_CMD_SRV_RAW_ARGS("Perl", perldo, "Perl Code"),
>>>>   +    MP_CMD_DIR_RAW_ARGS_ON_READ("<Perl", perl, "Perl Code"),
>>>>   +    MP_CMD_DIR_RAW_ARGS("Perl", perldo, "Perl Code"),
>>> As mentioned here several times, this naming is confusing. It's 
>>> misleading, since it suggests DIR when it is not the case. Why not 
>>> call the macros differently? s/DIR/SRV_N_HTACCESS/ or whatever other 
>>> name you prefer?
>> I agree that DIR is certainly not clear. SRV_N_HTACCESS seems a bit 
>> lenghty to me, but sounds like a much better alternative already.
>> But if you think about it, the macro _DIR_ does enable a command for 
>> DIR context (that's <Location>, etc and .htaccess) and it's in the
>> directive itself that we choose to restrict this down to exclude 
>> <Location> blocks and stuff.
> Hmm, the two paragraphs sound contradictory to each other. :)

Not quite, but I understand your confusion. The problem comes from the 
fact that you can't just directly tell apache
to allow this directive in Server and htaccess context. You basically 
have to say OR_ALL (everything). Then in
the directive code itself, you need to check if you are in block context 
(directory, files, location, etc) and bomb out

> If the macro is supposed to suggest the allowed context and PerlModule 
> is not allowed in DIR, then DIR is not appropriate. I see no problem 
> with long names if they require no extra source code reading to figure 
> out what they really do. These are internal macros and there are used 
> in one place, so what's the big deal with choosing a clear name, even 
> if it's long?

Well, there are 2 macros that must work together, so one possibility 
would be so call

  MP_CMD_ANYWHERE_RAW_ARGS("Perl", perldo, "Perl Code"),

And clearly at the top of the perldo implementation:

Would something like that be somewhat clearer ?

View raw message