Can I be assured the following code generates a unique cookie id in a mod_perl environment?
Nope.
For example, it's perfectly feasible that two requests could be processed in under a second on a single Apache process, and the same random number come up twice.
Also, since you're not separating the values you use with a delimiter you can get the same string from different values, e.g.:
| $ToBase62->(time) | $ToBase62->($$) | ToBase62->( rand($$)) |
|---|---|---|
| 1234 | 567 | 89 |
| 12345 | 678 | 9 |
both give the same ID.
Personally I tend to use Data::UUID for creating unique IDs.
In reply to Re: unique cookie id?
by adrianh
in thread unique cookie id?
by rkg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |