http://www.perlmonks.org?node_id=529221

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm confused again.

I'm using File::Temp in a CGI program on apache/LINUX. The temp files get created just fine but I need to access them later in the program with another program called with system(). Problem is the permissions are 600 and the owner is 'nobody'.

I guess what I'm asking is what is the best way to deal with this to be portable? I soppose I could use chmod() but what will windows think?

Replies are listed 'Best First'.
Re: File::Temp permisions?
by misterb101 (Sexton) on Feb 10, 2006 at 11:14 UTC
    Hi anonymous, the owner of new files created by an cgi process is the user that is running apache. usually this is www-data, apache or just nobody.
    I don't think File::Temp offers setting of file permissions but you can do this by either.
    - chmod 0755 ,$file;
    - changing apache config to set the file create mask to 755 or whatever you like

    In windows I don't know what would happen since I never work on windows systems anymore ;)

    Cheers,
    Rob
Re: File::Temp permisions?
by MCS (Monk) on Feb 10, 2006 at 14:52 UTC

    I don't really do windows much anymore but file permissions are a bit lax on windows so I don't think it should be a problem. If I remember correctly, chmod() is ignored on windows.