Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
It's not clear to me why you need the "uniqueness" at all?

The requirement came out of a real situation.

A bug caused the program to crash and leave behind some of its temporary files. I was away from the machine at the time. When I came back, I re-ran the program having made a few changes--including correcting the problem that caused the crash I hadn't noticed happen--and the second phase of the code mixed up the content of the previous run with those of the current run. I spent a long time trying to work out why the final output was completely screwed up before noticing that the previous run had terminated badly whilst reviewing the debug trace in the console buffer.

Imagine how annoying it would be if your system sort utility mixed up spill files from an interrupted run with those generated by the current run.

Any mechanism that relies upon correct clean-up of either the files themselves or semaphore files is vulnerable to the same issue.

For the PID + timestamp to fail, the system would have to issue exactly the same PID at exactly the same time--within the resolution of the timestamp granularity. The combined value suitably encoded (hex or base64) will be used as the prefix supplied to tempname() to generate the names for the temp. files.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^4: Generate a unique ID by BrowserUk
in thread Generate a unique ID by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-25 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found