Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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

by choroba (Cardinal)
on Dec 10, 2021 at 13:27 UTC ( [id://11139546]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11139546]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2026-04-23 02:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.