perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [Patch mp2] remove the magicness of PerlLoadModule wrt directives
Date Mon, 08 Nov 2004 22:36:58 GMT
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


Mime
View raw message