in reply to Using the file handle created by File::Temp to set specific file permissions

Once you run chmod in a shell with more permissive setting than =u+rw/0600 (which is the permissions File::Temp uses when creating a temp file), the temp file is insecure. So if you're OK with that approach, ignore the "maximum security" recommendation and follow the same steps in Perl, i.e. use the filename. You can't rename a filehandle.

Fcntl is mentioned for "passing it [the file descriptor] to another process". You don't need it for chmod or rename.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
  • Comment on Re: Using the file handle created by File::Temp to set specific file permissions
  • Download Code

Replies are listed 'Best First'.
Re^2: Using the file handle created by File::Temp to set specific file permissions
by mldvx4 (Hermit) on Dec 11, 2021 at 06:02 UTC

    Thanks. Looking further into this, File::Copy can work with file handles and even has a "move" function.