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

Re: Is it possible to generate unique temporary filenames using hostname/process id?

by bageler (Hermit)
on Mar 13, 2004 at 02:25 UTC ( [id://336325]=note: print w/replies, xml ) Need Help??


in reply to Is it possible to generate unique temporary filenames using hostname/process id?

$$ and a microtime might be better, but still doesn't 100% ensure uniqueness.
  • Comment on Re: Is it possible to generate unique temporary filenames using hostname/process id?

Replies are listed 'Best First'.
Re: Re: Is it possible to generate unique temporary filenames using hostname/process id?
by iguanodon (Priest) on Mar 14, 2004 at 01:29 UTC
    Ok, I know I run the risk of looking like a dumbass here but (assuming a Unix platform) what's wrong with $$ . time()? Is the risk that so many processes are created within one second that the PIDs roll over?
      Stick a long random number on the end and your odds are pretty good. Of course, there's no reason not to look for a name collision to guarantee it.

Log In?
Username:
Password:

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

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

    No recent polls found