Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Passing Arguments to Perl Modules during Apache Startup

by echo (Pilgrim)
on Sep 13, 2001 at 11:47 UTC ( #112128=note: print w/replies, xml ) Need Help??


in reply to Passing Arguments to Perl Modules during Apache Startup

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.

Use PerlSetVar the usual way:

PerlSetVar foo bar

Then in your startup.pl file, access them like this:

my $config = Apache->server->dir_config('foo');

On a side note, it's best if possible to stay away from PerlSetEnv/PerlPassEnv, because setting up the environment at request time is costly. If you don't use the %ENV at all in your modules then you can save some cycles by configuring PerlSetupEnv Off.

Just to add some spice to the this problem, I definitely would like to keep the solution to this within the httpd.conf file.

Check out Perl Sections: you can directly set yourp ackage variables from httpd.conf:

<Perl> $My::Config::foo = 'bar'; </Perl>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://112128]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2019-04-25 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I am most likely to install a new module from CPAN if:
















    Results (124 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!