Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: unique file ID

by marto (Bishop)
on Apr 30, 2013 at 11:04 UTC ( #1031384=note: print w/replies, xml ) Need Help??


in reply to unique file ID

Another solution would be to use something like File::Temp.

Replies are listed 'Best First'.
Re^2: unique file ID
by davido (Archbishop) on Apr 30, 2013 at 19:18 UTC

    This is an excellent solution.

    File::Temp detects and avoids collisions. It has a limited number of re-tries, so it also helps to use a template with a long enough wildcard segment that a collision is as likely as the earth's destruction by asteroid this month.

    File::Temp practices RAII safety by putting the clean-up code in its destructor so that even if the program terminates through an exception the destructor will remove the temp file.

    Parallel processing can wreck havoc on safe resource acquisition, but File::Temp has you covered (though you should read the POD section on forking).

    Security, community refinement, active maintenance, and extensive testing are all attributes that contribute to making this a good choice.


    Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1031384]
help
Chatterbox?
[Discipulus]: after an error now is back
[shmem]: looks like a 302 loop - "The document has moved here"
[Discipulus]: ..but only http not https
[shmem]: hmm after some looping I get it via http
[choroba]: After submitting the form, I'm getting "Sorry, we're really busy right now, please wait for a bit. This page will automagically refresh soon"
[hippo]: Still nothing via https
marto pictures someone trying to fix a problem, while the page gets battered by F5s :P

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (11)
As of 2018-02-20 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (271 votes). Check out past polls.

    Notices?