httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject getting config file in TestConfigParse.pm
Date Mon, 03 Oct 2005 05:38:12 GMT
I was wondering about this change:
  http://svn.apache.org/viewcvs.cgi/perl/Apache-Test/trunk/lib/Apache/TestConfigParse.pm?rev=279322&r1=226979&r2=279322
in TestConfigParse.pm, which reads in part:

              # SERVER_CONFIG_FILE might be an absolute path
-            $file = $default_conf if !-e $file and -e $default_conf;
+            if (! -e $file && -e $default_conf) {
+                $file = $default_conf;
+            }
+            else {
+              # try a little harder
+              if (my $root = $self->{httpd_defines}->{HTTPD_ROOT}) {
+                  debug "using HTTPD_ROOT to resolve $default_conf";
+                  $file = catfile $root, $default_conf;
+              }
+            }
          }
      }

If $file does exist, then the
     if (! -e $file && -e $default_conf) {
     }
is ignored, but the
     else {
     }
will be followed; in my case, on Win32, it overwrote 
the correct, exisiting $file with
    $file = catfile $root, $default_conf;
which didn't exist. The following patch:
=========================================================
Index: Apache-Test/lib/Apache/TestConfigParse.pm
===================================================================
--- Apache-Test/lib/Apache/TestConfigParse.pm	(revision 293219)
+++ Apache-Test/lib/Apache/TestConfigParse.pm	(working copy)
@@ -347,15 +347,17 @@
              $file = catfile $base, $default_conf;

              # SERVER_CONFIG_FILE might be an absolute path
-            if (! -e $file && -e $default_conf) {
-                $file = $default_conf;
-            }
-            else {
-                # try a little harder
-                if (my $root = $self->{httpd_defines}->{HTTPD_ROOT}) {
-                    debug "using HTTPD_ROOT to resolve $default_conf";
-                    $file = catfile $root, $default_conf;
+            unless (-e $file) {
+                if (-e $default_conf) {
+                    $file = $default_conf;
                  }
+                else {
+                    # try a little harder
+                    if (my $root = $self->{httpd_defines}->{HTTPD_ROOT}) {
+                        debug "using HTTPD_ROOT to resolve $default_conf";
+                        $file = catfile $root, $default_conf;
+                    }
+                }
              }
          }
      }

==========================================================================
fixed that for me.

-- 
best regards,
randy

Mime
View raw message