David L. Fielding wrote:
Topic: Conflict with identical scripts loaded into independent virtual hosts

Hello,

We have been running a single instance of a large Perl application under
Apache/mod_perl for a long time. We would like to run the same script (but each with
different configuration data) under different virtual hosts.

According to all of the documentation I've read, a script running under a
virtual host should be loaded into a package name derived from the virtual host.

This is correct behaviour, yes.

Test1:
-------
package fred;

use CGI qw(:standard);
use strict;

sub test_sub {
      CGI::p("Host1 subroutine");
}

print CGI::header, start_html (), CGI::p("Host1 parent"), &test_sub(), end_html();
-------

Your problem is caused by the fact that you explicitely define a package in your registry script (package fred). Apache::Registry does wrap each registry script in it's own package (vhost included), but you then place each script back into the fred package. Thus colliding packages.

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Attachment: signature.asc
Description: OpenPGP digital signature



Reply via email to