in reply to Re^2: Generate a unique ID
in thread Generate a unique ID
if you look for atomic test, you can also open files with O_CREAT | O_EXCL. Then, you can just use pid + start time + local counterunless (mkdir $dir) { -d $dir && ... dir exists; -w _ || ... not writable by euid -x _ || ... not traversable by euid }
$fh = IO::File->new ($filename, O_EXCL | O_CREAT | ...)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Generate a unique ID
by BrowserUk (Patriarch) on Nov 16, 2010 at 08:16 UTC |