Saturday, 15 June 2013

time - Version 5 UUID in Perl -


offensive:

I am new to overflow stack, and I say hello!

on topic:

I am creating 5 UUID for a version which requires creating and deleting random folders through a timestamp. Is time () via

  my $ md5_UUID = create_uuid_as_string (UUID_MD5, time. "$ Job");   

These folders are created per run on each task, and are deleted after running. If the same UUID is generated in some way, then + -1000 can stop the jobs.

Is there any information that I would like to have or any the possibility of conflict (different data generating the same UUID)? Are they really unique? Also, which version of UUID should be used between SHA1 and MD5?

Use the OS tool

Perhaps there is a pure Pearl solution, but it Can be overkill. If you are on a Linux system, you can capture the results of mktemp or uuidgen and use them in your Perl script. For example:

  $ perl-e 'print' mktemp - directory '' /tmp/tmp.vx4Fo1Ifh0 $ perl -e '$ folder = `uuidgen`; Print $ folder '113754e1-fae4-4685-851d-fb346365c9f0   

The mktemp utility is good because it will create an atomic directory for you, returning additional directory name of the. You have the ability to modify the template in more meaningful names (see man 1 mktemp ); On the contrary, the UUID is not really good in the message of useful semantics.

No comments:

Post a Comment