Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Passing Arguments to Perl Modules during Apache Startup

by echo (Pilgrim)
on Sep 13, 2001 at 11:47 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://112128]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (2)
As of 2024-04-19 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found