Re: Sinister variable caching problem with rand()
Perrin Harkins <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
On Sat, May 15, 2010 at 4:03 PM, Anthony Esposito <[email protected]> wrote: > In one of my programs I started to receive database errors for not having a > unique id. I generate unique ids for each of the mysql lines that I add to > the database. I realized that the perl variable $idNum was keeping the same > random string for multiple executions. You need to call srand() in s a child init handler: http://marc.info/?l=apache-modperl&m=123904225030744&w=1 However, I have to ask, why are you generating id numbers randomly? Why not just let mysql do it with auto_increment? - Perrin