Boysenberry Payne wrote:

>> But what if the module Module::Name "use" or "require" other modules?
>> Are they also loaded before the server forks, or I need to load them
>> with "PerlModule ..." in httpd.conf?

> Good question. I think it might depend on how the requires/uses are scoped
> in the scripts that are included. I'm pretty sure any use statements
> that are
> scoped globally will be included in each forked copy of the server. To
> insure
> they are included it is suggested you add your use statements to the
> file. Probably including your use/require statements in a BEGIN {}
> block will
> help to insure they are pre-compiled.

"use" is not scoped. It's a compile time pragma, so it happens at compile time,
not when the code is executed. A "use" anywhere in Perl program is the same as a
"use" at the top. We just normally put them at the top for organization.

If you have a question about whether or not a module has been loaded by Perl
before Apache forks, print out the contents of %INC. Anything in there has been
loaded by Perl. If I use A which uses B which uses C, then they should all be in
%INC. There's no trickery involved or anything special about mod_perl. If Perl
knows about the module and has loaded it, it's in memory.

Michael Peters
Plus Three, LP