You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Arshavir Grigorian <ag...@ejpress.com> on 2001/10/29 17:11:55 UTC

subroutines

Hello All,

This might be a very obvious question to many of you, but for me it's
still somewhat unclear.

I am running Apache 1.3.19 mod_perl/1.24_01 on a RedHat 7.1 box (PC).

I have 2 versions of code running under 2 different virtual hosts. As
you probably guessed, my subroutine definitions are getting overriden,
and subroutines from package on one tree, get called by programs in the
other  tree.
The mod_perl documentation suggests that by using the Apache::PerlVINC
module it is possible to load
the appropriate module based upon the name of the virtual host used.
The 2 questions I have are:

1)  as my modules are not used as PerlHandler (as is the case with the
example in the online documentation 'PerlHandler Apache::Status'), I am
not quite sure how to configure Apache to simply
reload a "simple" module when a request is made against a specific
virtual host.

Previously, I used the PerlScript directive to load the modules:

httpd.conf
-----------------
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI -Indexes

PerlScript    /path_to_cgi/main.pl
------------------

main.pl
-----------------
use lib (/path_to_cgi/main.pl)
use Module1;
use Module2;
...
sub subroutine1 {}
sub subroutine2 {}
-----------------

How can I configure it so that when a request is made against

- http://qa/cgi-bin/main.plex => /path_to_qa/main.plex is loaded (with
all underlying modules)
- http://devel/cgi-bin/main.plex => /path_to_devel/main.plex is loaded
(with all underlying modules)

2) and if it is possible to do this, are the modules cached via mod_perl
(Apache::Registry) when several consequtive requests are made against
the same vhost (say http://qa/)

Thanks in advance!

Arshavir