Hello everyone, I am currently running a web server using Perl CGI for all my web sites and have been attracted to mod_perl for the performance advantages - particularly not having to start a new perl interpreter for each request. I have tried using Apache::Register and Apache::PerlRun but am having problems due to the fact that each web site refers to their own copy of my module called Site.pm (to contain functions, global variables etc). The problem is that the my scripts get confused and use variables from the other site's modules randomly.
The following example is using Apache::PerlRun (as it's supposed to be more forgiving that Apache::Register). I am using Apache 1.3.26 and mod_perl 1.26 on Debian Woody. .htaccess --------- PerlModule Apache::PerlRun <files *.pl> SetHandler perl-script PerlHandler Apache::PerlRun Options +ExecCGI </files> site1.pl -------- #!/usr/bin/perl use strict; use CGI; use lib "lib1"; use Site; my $q = new CGI; print $q->header(); print <<EOF; Site 1<br> VAR: $VAR<br> EOF lib1/Site.pm ------------ #!/usr/bin/perl -w package Site; require Exporter; use strict; our $VAR = "Site one"; our @ISA = qw(Exporter); our @EXPORT = qw($VAR); 1; site2.pl -------- #!/usr/bin/perl use strict; use CGI; use lib "lib2"; use Site; my $q = new CGI; print $q->header(); print <<EOF; Site 2<br> VAR: $VAR<br> EOF lib2/Site.pm ------------ #!/usr/bin/perl -w package Site; require Exporter; use strict; our $VAR = "Site two"; our @ISA = qw(Exporter); our @EXPORT = qw($VAR); 1; I then call site1.pl and site2.pl multiple times and get output like this: Site 1 VAR: Site two Site 1 VAR: Site one Site 1 VAR: Site two Site 2 VAR: Site two Site 2 VAR: Site two Site 2 VAR: Site one I can fix this problem by adding the line "PerlSetVar PerlRunOnce On" to my .htaccess file, but my performance tests show that this is actually slower than regular CGI!! Is there anything I can do to make this work properly without renaming all my Site.pm modules (and all scripts that call them) to have unique names? Thanks, Pinunki __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com