Donnie has asked for the wisdom of the Perl Monks concerning the following question:
Something that really puzzles me. I got a neat script here from a fellow monk "nothingmuch" that works great to write a new line in another cgi script. The script that gets written to is originally chmod (ed) rwx-r x-r x, (755). However - once the script gets written to the chmod has become rw -r -r , that is, all the "executes" have been removed from the permissions and the original script will not run again till I go back to my host server and change it back manually. The code is below. Anyone know how to fix this?? Thanks so much for looking.....
#!/usr/local/bin/perl use CGI ':standard'; print "Content-type: text/html\n\n"; open (FILE,"writeline.cgi"); open (TEMP,">external_file.txt.tmp"); my $i = 0; while (<FILE>) { if ($i == 13){ $_ = "\$pageFile=\"webpage.html\";\n" if ($i == 13); } print TEMP $_; } continue { $i++; } close FILE; close TEMP; unlink ("write.cgi"); rename ("external_file.txt.tmp","writeline.cgi");
edited: Wed Oct 16 15:54:58 2002 by jeffa - code tags s/<br>//g
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: chmod changes on server when script runs
by defyance (Curate) on Oct 15, 2002 at 20:13 UTC | |
|
Re: chmod changes on server when script runs
by bnanaboy (Beadle) on Oct 15, 2002 at 20:17 UTC | |
|
Re: chmod changes on server when script runs
by nothingmuch (Priest) on Oct 15, 2002 at 20:39 UTC | |
by Donnie (Acolyte) on Oct 15, 2002 at 20:44 UTC | |
|
Re: chmod changes on server when script runs
by thor (Priest) on Oct 16, 2002 at 13:35 UTC |