You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Stas Bekman <st...@stason.org> on 2001/11/12 18:13:57 UTC

[patch] allow t/conf/foo.pl.in to be autoconfigured

in order to test RegistryLoader (unreleased yet) I need to add an extra
startup.pl file, and I need the autoconfiguration's @ServerRoot@ token to
work in this new file. This patch allows to drop into t/conf any file
ending with .in (foo.bar.in) and it'll be converted into foo.bar and run
through tokens substitution. If the file is .conf it will be automatically
loaded via Include, .pl via PerlRequire.

Index: Apache-Test/lib/Apache/TestConfig.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.79
diff -u -r1.79 TestConfig.pm
--- Apache-Test/lib/Apache/TestConfig.pm	2001/11/01 18:39:11	1.79
+++ Apache-Test/lib/Apache/TestConfig.pm	2001/11/12 16:55:08
@@ -817,7 +817,7 @@
     my(@extra_conf, @conf_in, @conf_files);

     finddepth(sub {
-        return unless /\.conf\.in$/;
+        return unless /\.in$/;
         push @conf_in, catdir $File::Find::dir, $_;
     }, $self->{vars}->{t_conf});

@@ -895,7 +895,15 @@

     if (my $extra_conf = $self->generate_extra_conf) {
         for my $file (@$extra_conf) {
-            $self->postamble(Include => qq("$file"));
+            if ($file =~ /\.conf$/) {
+                $self->postamble(Include => qq("$file"));
+            }
+            elsif ($file =~ /\.pl$/) {
+                $self->postamble(PerlRequire => qq("$file"));
+            }
+            else {
+                # nothing yet
+            }
         }
     }

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Re: [patch] allow t/conf/foo.pl.in to be autoconfigured

Posted by Stas Bekman <st...@stason.org>.
Doug MacEachern wrote:

> On Tue, 13 Nov 2001, Stas Bekman wrote:
> 
> 
>>in order to test RegistryLoader (unreleased yet) I need to add an extra
>>startup.pl file, and I need the autoconfiguration's @ServerRoot@ token to
>>work in this new file. This patch allows to drop into t/conf any file
>>ending with .in (foo.bar.in) and it'll be converted into foo.bar and run
>>through tokens substitution. If the file is .conf it will be automatically
>>loaded via Include, .pl via PerlRequire.
>>
> 
> i wouldn't mind *.in.  but the right solution to your particular problem
> is to use Apache::server_root_relative() instead of @ServerRoot@

that works. So should I commit the *.in patch or wait until next time we 
need it? I think this can be useful for other projects using Apache::Test.

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Re: [patch] allow t/conf/foo.pl.in to be autoconfigured

Posted by Doug MacEachern <do...@covalent.net>.
On Tue, 13 Nov 2001, Stas Bekman wrote:

> in order to test RegistryLoader (unreleased yet) I need to add an extra
> startup.pl file, and I need the autoconfiguration's @ServerRoot@ token to
> work in this new file. This patch allows to drop into t/conf any file
> ending with .in (foo.bar.in) and it'll be converted into foo.bar and run
> through tokens substitution. If the file is .conf it will be automatically
> loaded via Include, .pl via PerlRequire.

i wouldn't mind *.in.  but the right solution to your particular problem
is to use Apache::server_root_relative() instead of @ServerRoot@