in reply to Re: Create a file with Perl
in thread Create a file with Perl

Does that mean there is nothing I can do to get the script to do this automatically? The script needs to create a brand new file and I don't want the user to have to do this. If the user has to stop and create their own file every time the script is run, it is useless. I tried

open(FH, "> $myfile") || die "Can't open $file for write: $!";

to create a new file, but it still gave me "permission denied" . Is there something weird I can do with setuid or something to change the user the script is running as?

By the way, thanks for answering!

Replies are listed 'Best First'.
RE: RE: Re: Create a file with Perl
by BastardOperator (Monk) on Sep 17, 2000 at 06:20 UTC
    No, what I said was that you would need to create a directory ahead of time in which those files will be created. The directory needs to have proper permissions most likely 777, but if the data that they are writing is somehow sensitive, you'll need to make the nobody user the owner of the directory and give it 755 permissions. Then, instead of
    open(FH, "> $myfile") ...
    do
    open(FH, "> somedirectorytheycanwriteto/$myfile") ...
RE: RE: Re: Create a file with Perl
by Fastolfe (Vicar) on Sep 18, 2000 at 05:56 UTC
    If you're not worried about file persistence (for long periods) or data sensitivity, you can try placing the files in /tmp.
      If you want temporary files use File::Temp. There are a lot of reasons for my saying that, including avoiding a ton of potential security problems.