You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philippe M. Chiasson" <go...@ectoplasm.org> on 2004/11/08 20:22:11 UTC

[Patch mp2] remove the magicness of PerlLoadModule wrt directives

Attached is the small patch to remove the magicness of PerlLoadModule and add
Apache::Module::add() as discussed earlier.

-- 
--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Re: [Patch mp2] remove the magicness of PerlLoadModule wrt directives

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.

Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> 
>> Index: src/docs/2.0/api/Apache/Module.pod
>> ===================================================================
> 
> 
>> +  #Define a configuration directive
>> +  my @directives = (
>> +    name => 'MyDirective',
>> +  );
> 
> 
> 1) indent 4 s.t.p.
> 2) where is the hash ref?
> 
> otherwise +1 to commit

Done deal!

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 
88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 
88C3A5A5

Re: [Patch mp2] remove the magicness of PerlLoadModule wrt directives

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:

> Index: src/docs/2.0/api/Apache/Module.pod
> ===================================================================

> +  #Define a configuration directive
> +  my @directives = (
> +    name => 'MyDirective',
> +  );

1) indent 4 s.t.p.
2) where is the hash ref?

otherwise +1 to commit

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [Patch mp2] remove the magicness of PerlLoadModule wrt directives

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> 
>> Attached is the small patch to remove the magicness of PerlLoadModule 
>> and add
>> Apache::Module::add() as discussed earlier.
> 
> excellent! a few minor comments below.
> 
>> [...]
>> +
>> +Apache::Module::add(__PACKAGE__, \@CMDS);
> 
> I suppose there is no point making those upcase anymore, since they 
> aren't special (above and below / tests + docs). What do you think?

Think it's a very good idea, and I liked Geoff's suggestion of 
@directives instead.

>> Index: src/docs/2.0/api/Apache/CmdParms.pod
> 
> [...]
> 
>>  The extra information passed through C<cmd_data> in
>> -C<L<@APACHE_MODULE_COMMANDS|docs::2.0::user::config::custom/C_cmd_data_>>. 
>>
>> +C<L<@CMDS|docs::2.0::user::config::custom/C_cmd_data_>>.
> 
> 
> but it's no longer passed in cmd_data user-wise. Shouldn't it link to 
> Apache::Module::add() and the latter to cmd_data?

Yes, I guess it makes more sense that way.

> [...] 
> missing add() call?

Yup.

>> Index: src/docs/2.0/api/Apache/Const.pod
> [...]  
>> -=item * A global array C<@APACHE_MODULE_COMMANDS> for declaring the
>> -new directives and their behavior.
>> +=item * An array C<L<@CMDS|/C__CMDS_>> for declaring the new 
>> directives and their
>> +behavior.
>> +
>> +=item * A call to 
>> C<L<Apache::Module::add()|docs::2.0::api::Apache::Module/C_add_>> to 
>> register the new
>> +directives with apache.
>  
> wrap the line?

Indeed.

> [...]
> 
> may be add a note that @CMDS is not a special name and any other name 
> will do?

That's a good idea. Added.

>> +=head2 Apache::Module::add()
> 
> Call it: "Activating the new directive" or "Registering ..."  or 
> something like that? Apache::Module::add() looks like an API entry, 
> which is already defined elsewhere.

"Registering the new directives" is it.

-- 
--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 
88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 
88C3A5A5

Re: [Patch mp2] remove the magicness of PerlLoadModule wrt directives

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Geoffrey Young wrote:

>>>+Apache::Module::add(__PACKAGE__, \@CMDS);
>>>      
>>>
>>I suppose there is no point making those upcase anymore, since they
>>aren't special (above and below / tests + docs). What do you think?
>>    
>>
>
>I was going to say the same thing.
>
>  my @directives = (...);
>
>is probably a good choice, since that's the designation out there in the
>eagle book and cookbook, so folks using it can just take that array from the
>old Makefile.PL and paste it into the .pm.
>  
>
I like @directives much better than @CMDS, I'll make that change.

>other than that, I've applied the patch and ported both Apache-AuthenHook
>and Apache-Template over and they work just fine.
>
>+1
>  
>
Great, still fixing a few problems with the documentation, but it should 
reach your
nearest CVS server soon.

>--Geoff
>
>  
>


Re: [Patch mp2] remove the magicness of PerlLoadModule wrt directives

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
>> +Apache::Module::add(__PACKAGE__, \@CMDS);
> 
> 
> I suppose there is no point making those upcase anymore, since they
> aren't special (above and below / tests + docs). What do you think?

I was going to say the same thing.

  my @directives = (...);

is probably a good choice, since that's the designation out there in the
eagle book and cookbook, so folks using it can just take that array from the
old Makefile.PL and paste it into the .pm.

other than that, I've applied the patch and ported both Apache-AuthenHook
and Apache-Template over and they work just fine.

+1

--Geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [Patch mp2] remove the magicness of PerlLoadModule wrt directives

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> Attached is the small patch to remove the magicness of PerlLoadModule 
> and add
> Apache::Module::add() as discussed earlier.

excellent! a few minor comments below.

> Index: t/response/TestCompat/apache_module.pm
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache_module.pm,v
> retrieving revision 1.3
> diff -u -I$Id -r1.3 apache_module.pm
> --- t/response/TestCompat/apache_module.pm	16 Sep 2004 16:32:08 -0000	1.3
> +++ t/response/TestCompat/apache_module.pm	8 Nov 2004 19:09:38 -0000
> @@ -11,11 +11,13 @@
>  use Apache::compat ();
>  use Apache::Constants qw(OK);
>  
> -our @APACHE_MODULE_COMMANDS = (
> +my @CMDS = (
>      {
>          name => 'TestCompatApacheModuleParms',
>      },
>  );
> +
> +Apache::Module::add(__PACKAGE__, \@CMDS);

I suppose there is no point making those upcase anymore, since they aren't 
special (above and below / tests + docs). What do you think?

> Index: src/docs/2.0/api/Apache/CmdParms.pod
[...]
>  The extra information passed through C<cmd_data> in
> -C<L<@APACHE_MODULE_COMMANDS|docs::2.0::user::config::custom/C_cmd_data_>>.
> +C<L<@CMDS|docs::2.0::user::config::custom/C_cmd_data_>>.

but it's no longer passed in cmd_data user-wise. Shouldn't it link to 
Apache::Module::add() and the latter to cmd_data?

>    $info = $parms->info;
>  
> @@ -213,7 +216,7 @@
>  For example here is how to pass arbitrary information to a directive
>  subroutine:
>  
> -  our @APACHE_MODULE_COMMANDS = (
> +  my @CMDS = (
>      {
>        name => 'MyDirective1',
>        func => \&MyDirective,

missing add() call?

> Index: src/docs/2.0/api/Apache/Const.pod
> ===================================================================
> RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/Apache/Const.pod,v
> retrieving revision 1.27
> diff -u -I$Id -r1.27 Const.pod
> --- src/docs/2.0/api/Apache/Const.pod	17 Sep 2004 19:28:15 -0000	1.27
> +++ src/docs/2.0/api/Apache/Const.pod	8 Nov 2004 19:21:09 -0000
> @@ -87,7 +87,7 @@
>    use Apache::Const -compile => qw(:cmd_how);
>  
>  The C<:cmd_how> constants group is used in
> -C<L<@APACHE_MODULE_COMMANDS|docs::2.0::user::config::custom/C_args_how_>>
> +C<L<Apache::Module::add()|docs::2.0::user::config::custom/C_args_how_>>
>  and
>  C<L<$cmds-E<gt>args_how|docs::2.0::api::Apache::Command/C_args_how_>>.

same as C_cmd_data_ comment above?

> Index: src/docs/2.0/user/config/custom.pod
[...]
> -A minimal configuration module is comprised of two groups of elements:
> +A minimal configuration module is comprised of three groups of elements:
>  
>  =over
>  
> -=item * A global array C<@APACHE_MODULE_COMMANDS> for declaring the
> -new directives and their behavior.
> +=item * An array C<L<@CMDS|/C__CMDS_>> for declaring the new directives and their
> +behavior.
> +
> +=item * A call to C<L<Apache::Module::add()|docs::2.0::api::Apache::Module/C_add_>> to register the new
> +directives with apache.

wrap the line?

> -=head2 C<@APACHE_MODULE_COMMANDS>
> +=head2 C<@CMDS>
>  
> -C<@APACHE_MODULE_COMMANDS> is a global array of hash references. Each
> +C<@CMDS> is an array of hash references. Each
>  hash represents a separate new configuration directive. In our example
>  we had:
>  
> -  our @APACHE_MODULE_COMMANDS = (
> +  my @CMDS = (
>        {
>         name         => 'MyParameter',
>         func         => __PACKAGE__ . '::MyParameter',
> @@ -274,7 +278,7 @@
>  you to store arbitrary strings for later retrieval from your
>  directive handler.  For instance:
>  
> -  our @APACHE_MODULE_COMMANDS = (
> +  my @CMDS = (
>        {
>         name         => '<Location',
>         # func defaults to Redirect()
> @@ -313,6 +317,14 @@
>  chosen for a reason - this is exactly how httpd core handles these
>  two directives.

may be add a note that @CMDS is not a special name and any other name will do?

> +=head2 Apache::Module::add()

Call it: "Activating the new directive" or "Registering ..."  or something 
like that? Apache::Module::add() looks like an API entry, which is already 
defined elsewhere.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org