in reply to Re: Setting permissions as text file is created
in thread Setting permissions as text file is created

Hi, This place is great. Thanks for the prompt replies.

So my code becomes:

open (FILEHANDLE, ">>$filepath")||&ErrorMessage;
print FILEHANDLE "$pageoutput";
close FILEHANDLE;
chmod 0666, $filepath;

Intuitively I think that is what I would have guessed but I was hoping someone would suggest a way of ammending my code in a way that included permissions in the open filehandle line.

thanks again.

Best wishes

Sid
  • Comment on Re: Re: Setting permissions as text file is created

Replies are listed 'Best First'.
Re: Re: Re: Setting permissions as text file is created
by bart (Canon) on Mar 17, 2004 at 13:27 UTC
    Intuitively I think that is what I would have guessed but I was hoping someone would suggest a way of ammending my code in a way that included permissions in the open filehandle line.

    Then, like the other poster suggested, play with umask. On my system, its default value is 2, creating plain files with permissions 0664. If you were to (temporarily) set it to 0, the file created should have permissions set to 0666. It does for me.

    my $umask = umask 0; open (FILEHANDLE, ">>$filepath")||&ErrorMessage; umask $umask; print FILEHANDLE "$pageoutput"; close FILEHANDLE;