You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by go...@apache.org on 2004/11/09 06:44:15 UTC
cvs commit: modperl-2.0/t/response/TestDirective cmdparms.pm perlloadmodule.pm perlloadmodule2.pm perlloadmodule3.pm perlloadmodule4.pm perlloadmodule5.pm perlloadmodule6.pm
gozer 2004/11/08 21:44:15
Modified: . Changes
todo release
src/modules/perl modperl_cmd.c modperl_module.c
modperl_module.h
xs/Apache/Module Apache__Module.h
xs/maps apache_functions.map
xs/tables/current/ModPerl FunctionTable.pm
t/response/TestCompat apache_module.pm
t/response/TestDirective cmdparms.pm perlloadmodule.pm
perlloadmodule2.pm perlloadmodule3.pm
perlloadmodule4.pm perlloadmodule5.pm
perlloadmodule6.pm
Log:
Remove magicness of PerlLoadModule and implement Apache::Module::add()
for modules that implement their own configuration directives
Revision Changes Path
1.521 +3 -0 modperl-2.0/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.520
retrieving revision 1.521
diff -u -r1.520 -r1.521
--- Changes 27 Oct 2004 22:48:29 -0000 1.520
+++ Changes 9 Nov 2004 05:44:14 -0000 1.521
@@ -12,6 +12,9 @@
=item 1.99_18-dev
+Remove magicness of PerlLoadModule and implement Apache::Module::add()
+for modules that implement their own configuration directives [Gozer]
+
Apache::Connection::remote_ip is now settable (needed to set the
remote_ip record based on proxy's X-Forwarded-For header) [Stas]
1.70 +0 -5 modperl-2.0/todo/release
Index: release
===================================================================
RCS file: /home/cvs/modperl-2.0/todo/release,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- release 25 Oct 2004 21:57:17 -0000 1.69
+++ release 9 Nov 2004 05:44:14 -0000 1.70
@@ -46,11 +46,6 @@
See test TestAPR::pool
http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=108547894817083&w=2
-* revamp directive handlers, expose modperl_module_add, fix
- PerlLoadModule, etc.
- http://marc.theaimsgroup.com/?t=108309295200003
- owner: geoff
-
* per-server cleanups core dump or are otherwise ineffective
Apache->server->process->pconf->cleanup_register(sub { ... });
Report: geoff
1.67 +1 -3 modperl-2.0/src/modules/perl/modperl_cmd.c
Index: modperl_cmd.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- modperl_cmd.c 20 Sep 2004 18:14:48 -0000 1.66
+++ modperl_cmd.c 9 Nov 2004 05:44:14 -0000 1.67
@@ -630,8 +630,6 @@
*/
MP_CMD_SRV_DECLARE(load_module)
{
- apr_pool_t *p = parms->pool;
- server_rec *s = parms->server;
const char *errmsg;
MP_TRACE_d(MP_FUNC, "PerlLoadModule %s\n", arg);
@@ -643,7 +641,7 @@
return errmsg;
}
- return modperl_module_add(p, s, arg);
+ return NULL;
}
/* propogate filters insertion ala SetInputFilter */
1.19 +6 -17 modperl-2.0/src/modules/perl/modperl_module.c
Index: modperl_module.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_module.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- modperl_module.c 9 Oct 2004 18:27:43 -0000 1.18
+++ modperl_module.c 9 Nov 2004 05:44:14 -0000 1.19
@@ -566,13 +566,6 @@
return APR_SUCCESS;
}
-static AV *modperl_module_cmds_get(pTHX_ module *modp)
-{
- char *name = Perl_form(aTHX_ "%s::%s", modp->name,
- "APACHE_MODULE_COMMANDS");
- return get_av(name, FALSE);
-}
-
static const char *modperl_module_cmd_fetch(pTHX_ SV *obj,
const char *name, SV **retval)
{
@@ -633,7 +626,7 @@
}
static const char *modperl_module_add_cmds(apr_pool_t *p, server_rec *s,
- module *modp)
+ module *modp, SV *mod_cmds)
{
const char *errmsg;
apr_array_header_t *cmds;
@@ -643,12 +636,8 @@
#ifdef USE_ITHREADS
MP_dSCFG(s);
dTHXa(scfg->mip->parent->perl);
-#endif
-
- if (!(module_cmds = modperl_module_cmds_get(aTHX_ modp))) {
- return apr_pstrcat(p, "module ", modp->name,
- " does not define @APACHE_MODULE_COMMANDS", NULL);
- }
+#endif
+ module_cmds = (AV*)SvRV(mod_cmds);
fill = AvFILL(module_cmds);
cmds = apr_array_make(p, fill+1, sizeof(command_rec));
@@ -788,7 +777,7 @@
}
const char *modperl_module_add(apr_pool_t *p, server_rec *s,
- const char *name)
+ const char *name, SV *mod_cmds)
{
MP_dSCFG(s);
#ifdef USE_ITHREADS
@@ -834,7 +823,7 @@
modp->cmds = NULL;
- if ((errmsg = modperl_module_add_cmds(p, s, modp))) {
+ if ((errmsg = modperl_module_add_cmds(p, s, modp, mod_cmds))) {
return errmsg;
}
@@ -851,7 +840,7 @@
scfg->modules = apr_hash_make(p);
}
- apr_hash_set(scfg->modules, name, APR_HASH_KEY_STRING, modp);
+ apr_hash_set(scfg->modules, apr_pstrdup(p, name), APR_HASH_KEY_STRING, modp);
#ifdef USE_ITHREADS
/*
1.4 +1 -1 modperl-2.0/src/modules/perl/modperl_module.h
Index: modperl_module.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_module.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- modperl_module.h 4 Mar 2004 06:01:07 -0000 1.3
+++ modperl_module.h 9 Nov 2004 05:44:14 -0000 1.4
@@ -21,7 +21,7 @@
void modperl_module_config_table_set(pTHX_ PTR_TBL_t *table);
const char *modperl_module_add(apr_pool_t *p, server_rec *s,
- const char *name);
+ const char *name, SV *mod_cmds);
SV *modperl_module_config_get_obj(pTHX_ SV *pmodule, server_rec *s,
ap_conf_vector_t *v);
1.16 +22 -0 modperl-2.0/xs/Apache/Module/Apache__Module.h
Index: Apache__Module.h
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/Apache/Module/Apache__Module.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Apache__Module.h 17 Sep 2004 00:07:24 -0000 1.15
+++ Apache__Module.h 9 Nov 2004 05:44:14 -0000 1.16
@@ -73,3 +73,25 @@
{
return mod->minor_version;
}
+
+static MP_INLINE void mpxs_Apache__Module_add(pTHX_
+ char *package,
+ SV *cmds)
+{
+ const char *error;
+ server_rec *s;
+
+ if (!(SvROK(cmds) && (SvTYPE(SvRV(cmds)) == SVt_PVAV))) {
+ Perl_croak(aTHX_ "Usage: Apache::Module::add(__PACKAGE__, [])");
+ }
+
+ s = modperl_global_get_server_rec();
+ error = modperl_module_add(s->process->pconf, s, package, cmds);
+
+ if (error) {
+ Perl_croak(aTHX_ "Apache::Module::add(%s) failed : %s",
+ package, error);
+ }
+
+ return;
+}
1.106 +1 -0 modperl-2.0/xs/maps/apache_functions.map
Index: apache_functions.map
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- apache_functions.map 4 Oct 2004 19:27:37 -0000 1.105
+++ apache_functions.map 9 Nov 2004 05:44:14 -0000 1.106
@@ -212,6 +212,7 @@
>ap_show_modules
>ap_register_hooks
mpxs_Apache__Module_loaded
+ mpxs_Apache__Module_add
#ap_get_module_config
mpxs_Apache__Module_get_config | | pmodule, s, v=NULL
mpxs_Apache__Module_ap_api_major_version
1.190 +23 -1 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
Index: FunctionTable.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -r1.189 -r1.190
--- FunctionTable.pm 6 Oct 2004 17:55:08 -0000 1.189
+++ FunctionTable.pm 9 Nov 2004 05:44:14 -0000 1.190
@@ -2,7 +2,7 @@
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# ! WARNING: generated by ModPerl::ParseSource/0.01
-# ! Wed Oct 6 10:35:20 2004
+# ! Thu Nov 4 15:29:12 2004
# ! do NOT edit, any changes will be lost !
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -6169,6 +6169,28 @@
{
'type' => 'int',
'name' => 'query_code'
+ }
+ ]
+ },
+ {
+ 'return_type' => 'void',
+ 'name' => 'mpxs_Apache__Module_add',
+ 'attr' => [
+ 'static',
+ '__inline__'
+ ],
+ 'args' => [
+ {
+ 'type' => 'PerlInterpreter *',
+ 'name' => 'my_perl'
+ },
+ {
+ 'type' => 'char *',
+ 'name' => 'package'
+ },
+ {
+ 'type' => 'SV *',
+ 'name' => 'cmds'
}
]
},
1.4 +3 -1 modperl-2.0/t/response/TestCompat/apache_module.pm
Index: apache_module.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache_module.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- apache_module.pm 16 Sep 2004 16:32:08 -0000 1.3
+++ apache_module.pm 9 Nov 2004 05:44:15 -0000 1.4
@@ -11,11 +11,13 @@
use Apache::compat ();
use Apache::Constants qw(OK);
-our @APACHE_MODULE_COMMANDS = (
+my @directives = (
{
name => 'TestCompatApacheModuleParms',
},
);
+
+Apache::Module::add(__PACKAGE__, \@directives);
sub TestCompatApacheModuleParms {
my($self, $parms, $args) = @_;
1.10 +3 -1 modperl-2.0/t/response/TestDirective/cmdparms.pm
Index: cmdparms.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestDirective/cmdparms.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- cmdparms.pm 13 Sep 2004 23:02:35 -0000 1.9
+++ cmdparms.pm 9 Nov 2004 05:44:15 -0000 1.10
@@ -27,13 +27,15 @@
use constant KEY => "TestCmdParms";
-our @APACHE_MODULE_COMMANDS = (
+my @directives = (
{
name => +KEY,
cmd_data => 'cmd_data',
errmsg => 'errmsg',
},
);
+
+Apache::Module::add(__PACKAGE__, \@directives);
my @methods = qw(cmd context directive info override path
pool server temp_pool);
1.7 +5 -3 modperl-2.0/t/response/TestDirective/perlloadmodule.pm
Index: perlloadmodule.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestDirective/perlloadmodule.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- perlloadmodule.pm 13 Sep 2004 22:36:19 -0000 1.6
+++ perlloadmodule.pm 9 Nov 2004 05:44:15 -0000 1.7
@@ -11,7 +11,7 @@
use Apache::CmdParms ();
use Apache::Module ();
-our @APACHE_MODULE_COMMANDS = (
+my @directives = (
{
name => 'MyTest',
func => __PACKAGE__ . '::MyTest',
@@ -31,6 +31,8 @@
}
);
+Apache::Module::add(__PACKAGE__, \@directives);
+
sub DIR_CREATE {
my($class, $parms) = @_;
@@ -52,7 +54,7 @@
sub DIR_MERGE {
my $class = ref $_[0];
-# warn "$class->DIR_MERGE\n";
+ warn "$class->DIR_MERGE\n";
merge(@_);
}
@@ -64,7 +66,7 @@
sub SERVER_CREATE {
my($class, $parms) = @_;
-# warn "$class->SERVER_CREATE\n";
+ warn "$class->SERVER_CREATE\n";
return bless {
name => __PACKAGE__,
}, $class;
1.8 +3 -1 modperl-2.0/t/response/TestDirective/perlloadmodule2.pm
Index: perlloadmodule2.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestDirective/perlloadmodule2.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- perlloadmodule2.pm 13 Sep 2004 22:36:19 -0000 1.7
+++ perlloadmodule2.pm 9 Nov 2004 05:44:15 -0000 1.8
@@ -11,7 +11,7 @@
use Apache::CmdParms ();
use Apache::Module ();
-our @APACHE_MODULE_COMMANDS = (
+my @directives = (
{
name => 'MyMergeTest',
func => __PACKAGE__ . '::MyMergeTest',
@@ -20,6 +20,8 @@
errmsg => 'Values that get merged',
},
);
+
+Apache::Module::add(__PACKAGE__, \@directives);
sub merge {
my($base, $add) = @_;
1.6 +3 -1 modperl-2.0/t/response/TestDirective/perlloadmodule3.pm
Index: perlloadmodule3.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestDirective/perlloadmodule3.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- perlloadmodule3.pm 13 Sep 2004 22:36:19 -0000 1.5
+++ perlloadmodule3.pm 9 Nov 2004 05:44:15 -0000 1.6
@@ -16,12 +16,14 @@
use Apache::Const -compile => qw(OK);
-our @APACHE_MODULE_COMMANDS = (
+my @directives = (
{ name => 'MyPlus' },
{ name => 'MyList' },
{ name => 'MyAppend' },
{ name => 'MyOverride' },
);
+
+Apache::Module::add(__PACKAGE__, \@directives);
sub MyPlus { set_val('MyPlus', @_) }
sub MyAppend { set_val('MyAppend', @_) }
1.9 +3 -1 modperl-2.0/t/response/TestDirective/perlloadmodule4.pm
Index: perlloadmodule4.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestDirective/perlloadmodule4.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- perlloadmodule4.pm 13 Sep 2004 22:36:19 -0000 1.8
+++ perlloadmodule4.pm 9 Nov 2004 05:44:15 -0000 1.9
@@ -26,7 +26,9 @@
use constant KEY => "MyTest4";
-our @APACHE_MODULE_COMMANDS = ({ name => +KEY },);
+my @directives = ({ name => +KEY },);
+
+Apache::Module::add(__PACKAGE__, \@directives);
sub MyTest4 {
my($self, $parms, $arg) = @_;
1.8 +3 -1 modperl-2.0/t/response/TestDirective/perlloadmodule5.pm
Index: perlloadmodule5.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestDirective/perlloadmodule5.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- perlloadmodule5.pm 13 Sep 2004 22:36:19 -0000 1.7
+++ perlloadmodule5.pm 9 Nov 2004 05:44:15 -0000 1.8
@@ -24,7 +24,9 @@
use constant KEY => "MyTest5";
-our @APACHE_MODULE_COMMANDS = ({ name => +KEY },);
+my @directives = ({ name => +KEY },);
+
+Apache::Module::add(__PACKAGE__, \@directives);
sub MyTest5 {
my($self, $parms, $arg) = @_;
1.7 +3 -1 modperl-2.0/t/response/TestDirective/perlloadmodule6.pm
Index: perlloadmodule6.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestDirective/perlloadmodule6.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- perlloadmodule6.pm 13 Sep 2004 22:36:19 -0000 1.6
+++ perlloadmodule6.pm 9 Nov 2004 05:44:15 -0000 1.7
@@ -14,7 +14,9 @@
use constant KEY => "MyTest6";
-our @APACHE_MODULE_COMMANDS = ({ name => +KEY },);
+my @directives = ({ name => +KEY },);
+
+Apache::Module::add(__PACKAGE__, \@directives);
sub MyTest6 {
my($self, $parms, $arg) = @_;