Perrin Harkins wrote:
On Sat, May 15, 2010 at 4:03 PM, Anthony Esposito
<tony.m.espos...@gmail.com> 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
I think, in theory you shouldn't have to explicitly srand yourself in
your startup.pl if you're using mod_perl 1.29 or greater, and perl 5.8.1
or greater.
see:
http://marc.info/?l=apache-modperl-dev&m=106606815110220&w=2
Adam