randyk 2003/07/12 16:22:59
Modified: t TEST.win32
Log:
Put in some additional error checking when editing conf files.
Revision Changes Path
1.7 +16 -11 modperl/t/TEST.win32
Index: TEST.win32
===================================================================
RCS file: /home/cvs/modperl/t/TEST.win32,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TEST.win32 12 Jul 2003 23:17:33 -0000 1.6
+++ TEST.win32 12 Jul 2003 23:22:59 -0000 1.7
@@ -35,12 +35,11 @@
# prepare config files
#
-chdir "t/conf";
-copy("httpd.conf-win32", "httpd.conf");# PTI: unless -f httpd.conf;
-chdir "../net";
-
-#copy("config.pl.win32", "config.pl");# PTI: unless -f config.pl;
-chdir "../..";
+my $conf = 't/conf/httpd.conf';
+my $win32_conf = $conf . '-win32';
+my $bak = $conf . '.bak';
+copy($win32_conf, $conf)
+ or die "Copy of $win32_conf to $conf failed: $!";
#
#source or binary distribution
@@ -71,19 +70,25 @@
}
# change the paths so everybody agrees on which files to use
-
#
-
$pwd = cwd();
-
-
# this is to make sure apache knows which files to take
# : apparently apache uner Win32
# change directories to the installation directory so "./t"
# references do not work
-system "$fullperl -p -i.bak -e \"s#\\./t#$pwd/t#\" t/conf/httpd.conf";
+unless (-e $bak) {
+ copy($conf, $bak) or die "Copying $conf to $bak failed: $!";
+}
+open(BAK, $bak) or die "Open of $bak for reading failed: $!";
+open(CONF, ">$conf") or die "Open of $conf for writing failed: $!";
+while (<BAK>) {
+ s#\./t#$pwd/t#;
+ print CONF $_;
+}
+close BAK;
+close CONF;
#
# start ourselves a server to pound on