Chia-Liang Kao wrote:

 Allow core modules to be loaded explicitly with find_and_load_module.
 This allows the apache from FreeBSD ports (with most modules built as
 shared) to run tests with Apache::Test, and also allows testing svk
 with a dav server.

 * Apache/TestConfig.pm:
   (find_and_load_module): New.
   (generate_types_config): Use find_and_load_module to load mod_alias.
   (httpd_config): Load mod_cgi and mod_access as they are part of the
     core tests.

I like the find_and_load_module wrapper as it refactors some code dups.

But I don't think A-T should try to load any module someone may need in their test suite. It does have a bunch of mp2 specific things which should be wiped away and moved into the mp2 test suite.

This is your own test suite that you have the problem with, right? In which case I'd prefer to see a patch which subclasses Apache::TestConfig, so any test suite using A-T could decide which modules it wants to enforce loading from t/TEST. As we don't have any examples of how to subclass A-TC, let me know if you need help (it might be a tricky thing to do). You can see how we subclass Apache::TestRun in Apache-Test/t/TEST.PL.

Another possible solution is to provide a t/TEST option -load_module, which can be repeated several times, and will try to call your find_and_load_module. So you could add it into t/TEST directly as if it was passed from the command line.

+    $self->find_and_load_module ('mod_cgi.so');
+    $self->find_and_load_module ('mod_access.so');

+sub find_and_load_module {
+    my ($self, $name) = @_;
+    my $mod_path = $self->find_apache_module($name) or return;
+    my ($sym) = $name =~ m/mod_(\w+)\./;
+
+    if ($mod_path && -e $mod_path) {
+        $self->preamble(IfModule => "!$name",
+                        qq{LoadModule ${sym}_module "$mod_path"\n});
+    }
+    return 1;
+}



-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com

Reply via email to