please try this patch. it exposes the problem with messed up setup.

it adds the test for perlrequire and APACHE_TEST_CONFIGURE functionality.
this is just a first scatch.

Index: Apache-Test/lib/Apache/TestConfigPerl.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v
retrieving revision 1.19
diff -u -r1.19 TestConfigPerl.pm
--- Apache-Test/lib/Apache/TestConfigPerl.pm    2001/08/11 20:40:05
1.19
+++ Apache-Test/lib/Apache/TestConfigPerl.pm    2001/08/26 15:18:53
@@ -243,14 +243,21 @@
         finddepth(sub {
             return unless /\.pm$/;
             my @args;
-
+
             my $pm = $_;
-            my $module = catfile $File::Find::dir, $pm;
-            $self->add_module_config($module, \@args);
-            $module = abs2rel $module, $dir;
+            my $file = catfile $File::Find::dir, $pm;
+            $self->add_module_config($file, \@args);
+            my $module = abs2rel $file, $dir;
             $module =~ s,\.pm$,,;
             $module = join '::', splitdir $module;

+            require $file;
+            my $configure_sub = \&{$module."::APACHE_TEST_CONFIGURE"};
+            if ($configure_sub) {
+                eval {$self->$configure_sub};
+                warn $@ if $@;
+            }
+
             my($base, $sub) =
               map { s/^test//i; $_ } split '::', $module;


--- /dev/null   Sat Apr 14 19:06:21 2001
+++ t/directive/perlrequire.t   Sun Aug 26 23:00:57 2001
@@ -0,0 +1,31 @@
+# this test tests PerlRequire configuration directive
+########################################################################
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestRequest ();
+use Apache::TestConfig ();
+
+my %checks =
+    (
+     'default'                  => 'Loaded by Parent',
+     'TestDirective::perlrequire' => 'Loaded by Virtual Host',
+    );
+
+plan tests => scalar keys %checks;
+
+for my $module (sort keys %checks) {
+    local $Apache::TestRequest::Module = $module;
+    $Apache::TestRequest::Module ||= $module; #-w
+
+    my $config = Apache::TestConfig->thaw;
+    my $hostport = Apache::TestRequest::hostport($config);
+    print "connecting to $hostport\n";
+
+    my $res = $config->http_raw_get("/TestDirective::perlrequire",undef)
|| '';
+    print "expecting: $checks{$module}\n";
+    print "getting  : $res\n";
+    ok $res eq $checks{$module};
+}

--- /dev/null   Sat Apr 14 19:06:21 2001
+++ t/response/TestDirective/perlrequire.pm     Sun Aug 26 23:00:44 2001
@@ -0,0 +1,42 @@
+package TestDirective::perlrequire;
+
+use strict;
+use warnings FATAL => 'all';
+
+sub handler {
+    my $r = shift;
+
+    $r->content_type('text/plain');
+    $r->puts($PerlRequireTest::MAGIC || '');
+
+    0;# Apache::OK;
+}
+
+sub APACHE_TEST_CONFIGURE{
+    my $self = shift;
+    print STDERR "called! @_";
+}
+
+1;
+__END__
+PerlSwitches -Mlib=@serverroot@/lib/parent
+PerlRequire "PerlRequireTest.pm"
+
+<VirtualHost TestDirective::perlrequire>
+
+  PerlOptions +Parent
+  PerlSwitches -Mlib=@serverroot@
+  PerlSwitches -Mblib=@serverroot@
+  PerlSwitches -Mlib=@serverroot@/hooks
+  PerlSwitches -Mlib=@serverroot@/response
+  PerlRequire conf/modperl_extra.pl
+
+  PerlSwitches -Mlib=@serverroot@/lib/vh
+  PerlRequire "PerlRequireTest.pm"
+
+  #PerlRequire conf/require_test.pl
+  <Location /TestDirective::perlrequire>
+     SetHandler modperl
+     PerlResponseHandler TestDirective::perlrequire
+  </Location>
+</VirtualHost>

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to