Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Generate a unique ID

by Ratazong (Prior)
on Nov 15, 2010 at 09:33 UTC ( #871425=note: print w/ replies, xml ) Need Help??


in reply to Generate a unique ID

If your program will only run on one system you might also consider a counter stored in a file. Each time the program starts it will access the file, increase the counter and close it again. For handling concurrent runs of your program, you would just sleep(1) if/while your counter-file is locked for writing.

If your programs are running on several systems you might use the IP/MAC-address in conjunction with the counter and have a counter-file on each system....

HTH, Rata


Comment on Re: Generate a unique ID
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2015-07-01 20:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (19 votes), past polls