- 论坛徽章:
- 0
|
我有个CGI 程序一直运行好好的! 最近发现 open (OUTFILE, ">$temp_file");文件处理无法写入。我在shell下运行$temp_file可以写入,但通过web 浏览就不行,CGI已经把$config_file读出,但生成不了$temp_file这个文件。文件的权限我已经设过了!有谁碰到过这个问题??? 是不是apache执行权限问题??
代码如下
my $temp_file="/c/tftp/.config.txt";
system "touch '$temp_file'";
chmod 0777, $temp_file;
open (INFILE, $config_file);
open (OUTFILE, ">$temp_file");
while (<INFILE>) {
#chomp;
if (($_ =~ "Revision_Code=") && !($DB{SYSVER} eq "")) {
#print OUTFILE "# Revision_Code=\"$DB{SYSVER}\"\n";
#next;
#$_= "# Revision_Code=\"$DB{SYSVER}\"";
s/\".*\"/\"$DB{SYSVER}\"/;
}
if (/^.INIT_FLASH/) {if ($DB{BURN} eq "on") { s/^./ /; } else { s/^./#/;}}
if (/^.CONF_VPD/) {if ($DB{CONF} eq "on") { s/^./ /; } else { s/^./#/;}}
if (/^.CONF_FEA/) {if ($DB{FEA} eq "on") { s/^./ /; } else { s/^./#/;}}
if (/^.PRO_MODE/) {if ($DB{MODE} eq "PRO") { s/^./ /; } else { s/^./#/;}}
if (/^.HOME_MODE/) {if ($DB{MODE} eq "HOME") { s/^./ /; } else { s/^./#/;}}
if (/^.REWORK_DISKLESS/) {if ($DB{REWORK} eq "DISKLESS") { s/^./ /; } else { s/^./#/;}}
if (/^.TEST_DIS/) {if ($DB{TEST} eq "on") { s/^./#/; } else { s/^./ /;}}
if (/^.GSA/) {if ($DB{GSA} eq "GSA") { s/^./ /; } else { s/^./#/;}}
if (/^.ERASE_IMG/) {if ($DB{GSA} eq "GSA") { s/^./ /; } else { s/^./#/;}}
if (/^.ERASE_X86IMG/) {if ($DB{GSA} eq "GSA") { s/^./ /; } else { s/^./#/;}}
foreach my $test (@tests) {
if ($_ =~ $test) {
if ($DB{$test} =~ "on") { s/^.*DIS/# DIS/; }
else { s/^.*DIS/ DIS/; }
}
}
print OUTFILE;
}
close (INFILE);
close (OUTFILE);
#if (-e $temp_file) {
chmod 0777, $temp_file;
system "cp '/c/tftp/config.txt' '/c/tftp/bin/config.sav'";
system "cp '$temp_file' '/c/tftp/config.txt'";
show_error("Can not copy config.txt.") if ($? != 0);
#unlink "$temp_file";
#} |
|