On Thu, 11 May 2000, Martin Wood wrote:
> Our Apache::Registry CGIs need access to a dozen or so core modules - is
> there an elegant solution to loading these without seeing a dozen or so use
> statements at the head of the script?

Yes.  As Vivek pointed out, you can move them all into a startup.pl that
you pull in from httpd.conf with PerlRequire in your httpd.conf.  If you
don't need to import subroutines fom the modules (which ideally you
wouldn't, since it wastes some memory) you can then just remove the use
calls from the individual scripts.

On the other hand, if you must have the use statements because the modules
need to export some subs into the namespace of each script, you could use
the C preprocessor on your perl code.  Take a look at this:
http://theoryx5.uwinnipeg.ca/CPAN/data/Filter/Filter/cpp.html

Of course, you can also just continue to use "do common.pl", but put it in
BEGIN block so it doesn't run on every request.

- Perrin

Reply via email to