Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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 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?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (1)
As of 2022-01-19 02:43 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (55 votes). Check out past polls.