On Wednesday, Sep 17, 2003, at 11:59 US/Pacific, John Park wrote: [..]
This is what my script looks like:[..]
#!/usr/bin/perl
use CGI;
...
...
open(FILE,">newfile.txt") || die("newfile.txt: $!"); #script stops here due to permissions
that is the correct syntax - although you might not want to 'die()' in a CGI script - but let us defer that. { especially if you have already dealt with CGI::Carp }
Remember that most web servers are running as the web-server uid - www or apache - and so can only 'write' where that uid has 'write permission'. It can of course read/execute anything that is 'world readable/executable' but as a general rule of sanity, it is NOT WISE to make those directories 'world writable'. So when the code executes as www, it has no problem reading IN any files that it can read - but you really would not want to allow it to over-write your own CGI code and/or fill up the disk with a bunch of files, because each run of the CGI code needs to be different...
You might try something like
open(FILE, ">/tmp/newfile.txt") || die("newfile.txt: $!"); ....
assuming that the system allows users to write files there. and then have some other piece of CGI code 'read' from that file to verify that the file actually was written.
The alternative is to provide a directory that is world writable so that you can create the file in that directory outside of where you have the actual CGI
open(FILE, "> ../tmp/newfile.txt") || die("newfile.txt: $!"); ....
so you layout would look like
../cgi_bin/my.cgi ../tmp/newfile.txt
Or you may want to look at say
perldoc IO::File
and specifically new_tmpfile() if you really only need a quick temporary file.
ciao drieux
---
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]