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 Randy Kobes <ra...@theoryx5.uwinnipeg.ca> on 2005/10/03 07:38:12 UTC
getting config file in TestConfigParse.pm
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
Re: getting config file in TestConfigParse.pm
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> 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;
blarg, sorry about that.
> which didn't exist. The following patch:
looks good.
--Geoff