in reply to unique cookie id?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: unique cookie id?
by rkg (Hermit) on Dec 24, 2003 at 14:45 UTC |