stas 02/01/17 22:53:46
Modified: t/response/TestDirective perlrequire.pm
Log:
- use a safer namespace for the autogenerated module, s/My::/ApacheTest::/
Revision Changes Path
1.4 +12 -7 modperl-2.0/t/response/TestDirective/perlrequire.pm
Index: perlrequire.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestDirective/perlrequire.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- perlrequire.pm 22 Sep 2001 09:33:31 -0000 1.3
+++ perlrequire.pm 18 Jan 2002 06:53:46 -0000 1.4
@@ -1,5 +1,11 @@
package TestDirective::perlrequire;
+# Test whether vhost with 'PerlOptions +Parent', which doesn't inherit
+# from the base, has its own INC and therefore can have a modules with
+# the same namespace as the base, but different content.
+#
+# Also see the parallel TestDirective::perlmodule handler
+
use strict;
use warnings FATAL => 'all';
@@ -11,7 +17,7 @@
my $r = shift;
$r->content_type('text/plain');
- $r->puts($My::PerlRequireTest::MAGIC || '');
+ $r->puts($ApacheTest::PerlRequireTest::MAGIC || '');
Apache::OK;
}
@@ -27,16 +33,15 @@
my $vars = $self->{vars};
my $target_dir = catfile $vars->{documentroot}, 'testdirective';
-
# create two different PerlRequireTest.pm packages to be loaded by
# vh and main interpreters, on the fly before the tests start
while (my($test, $magic) = each %require_tests) {
my $content = <<EOF;
-package My::PerlRequireTest;
-\$My::PerlRequireTest::MAGIC = '$magic';
+package ApacheTest::PerlRequireTest;
+\$ApacheTest::PerlRequireTest::MAGIC = '$magic';
1;
EOF
- my $file = catfile $target_dir, $test, 'PerlRequireTest.pm';
+ my $file = catfile $target_dir, $test, 'ApacheTest', 'PerlRequireTest.pm';
$self->writefile($file, $content, 1);
}
}
@@ -45,7 +50,7 @@
__END__
<Base>
PerlSwitches -Mlib=@documentroot@/testdirective/main
- PerlRequire "PerlRequireTest.pm"
+ PerlRequire "ApacheTest/PerlRequireTest.pm"
</Base>
<VirtualHost TestDirective::perlrequire>
@@ -60,7 +65,7 @@
PerlRequire "conf/modperl_startup.pl"
PerlSwitches -Mlib=@documentroot@/testdirective/vh
- PerlRequire "PerlRequireTest.pm"
+ PerlRequire "ApacheTest/PerlRequireTest.pm"
<Location /TestDirective::perlrequire>
SetHandler modperl