Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
You are running a test and want to create a bunch of
temporary files in a directory, or tables in a database
with unique but not random names, and you want some minimal
protection against race conditions. You might use something
like nextuniq() for the files:
or use it like this for the tables:
see rob_au's comments for making something like this more safe - the do{}until, is especially nice. (But, his version of the nextunique() procedure won't work the same and I see no advantage). mkmcconn
In reply to get new item name by mkmcconn
|
|