dougm 01/12/13 18:44:57
Modified: perl-framework/Apache-Test/lib/Apache TestConfig.pm
Log:
add genfile_open method to cut down some noise
Revision Changes Path
1.102 +13 -23
httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm
Index: TestConfig.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- TestConfig.pm 2001/12/14 02:37:57 1.101
+++ TestConfig.pm 2001/12/14 02:44:57 1.102
@@ -621,7 +621,7 @@
$self->trace("generating $name");
}
-sub genfile {
+sub genfile_open {
my($self, $file) = @_;
# create the parent dir if it doesn't exist yet
@@ -633,12 +633,20 @@
my $fh = Symbol::gensym();
open $fh, ">$file" or die "open $file: $!";
+ $self->clean_add_file($file);
+
+ return $fh;
+}
+
+sub genfile {
+ my($self, $file) = @_;
+
+ my $fh = $self->genfile_open($file);
+
if (my $msg = $self->genwarning($file)) {
print $fh $msg, "\n";
}
- $self->clean_add_file($file);
-
return $fh;
}
@@ -646,15 +654,8 @@
sub writefile {
my($self, $file, $content, $nowarning) = @_;
- # create the parent dir if it doesn't exist yet
- my $dir = dirname $file;
- $self->makepath($dir);
+ my $fh = $self->genfile_open($file);
- $self->genfile_trace($file);
-
- my $fh = Symbol::gensym();
- open $fh, ">$file" or die "open $file: $!";
-
unless ($nowarning) {
if (my $msg = $self->genwarning($file)) {
print $fh $msg, "\n";
@@ -665,8 +666,6 @@
print $fh $content;
}
- $self->clean_add_file($file);
-
close $fh;
}
@@ -674,15 +673,8 @@
sub write_perlscript {
my($self, $file, $content) = @_;
- # create the parent dir if it doesn't exist yet
- my $dir = dirname $file;
- $self->makepath($dir);
-
- $self->genfile_trace($file);
+ my $fh = $self->genfile_open($file);
- my $fh = Symbol::gensym();
- open $fh, ">$file" or die "open $file: $!";
-
# shebang
print $fh "#!$Config{perlpath}\n";
@@ -693,8 +685,6 @@
if ($content) {
print $fh $content;
}
-
- $self->clean_add_file($file) = 1;
close $fh;
chmod 0555, $file;