Your skill will accomplish
what the force of many cannot
Passing Arguments to Perl Modules during Apache Startupby andreychek (Parson)
|on Sep 12, 2001 at 23:40 UTC||Need Help??|
andreychek has asked for the
wisdom of the Perl Monks concerning the following question:
I have some modules which make use of Apache and mod_perl. I have two things I would like to do with them:
1. Have the modules preloaded at Apache startup time
2. Pass configuration information to them as they are loaded
It's easy enough to preload them. I can either use the Apache "PerlModule" directive (preferred), or include a startup.pl file. The problem I am having is passing the configuration information to them.
Now, I've looked into using PerlSetVar, PerlSetEnv and PerlPassEnv. The problem is, these directives only seem to work when called through Apache via a browser. But when Apache is initially loading, Apache does not seem to pass any of this information to modules as it is loading them.
The data I need to pass are just a strings -- I don't necessarily need to pass arrays or hashes.
Just to add some spice to the this problem, I definitely would like to keep the solution to this within the httpd.conf file. The reason for this is that I would like to package these modules for easy use on multiple systems. I don't want sysadmins to have to dig all across their systems to find the configuration data for these modules. This configuration data I'm referring to is all webserver related, and fits in well with the httpd.conf file. We'll make some sysadmin happy by keeping this config info with the rest of the web config data in the httpd.conf. However, if the only solution you can think of wouldn't go into the httpd.conf file, I would still be glad to hear your thoughts :-)
Does anyone have any suggestions on how one might go about passing an argument to a Perl module during Apache's startup process? I would love to hear from you! Thanks :-)