David Jacobs wrote: > > I'm converting a few CGI scripts that used the PID as a cyclical unique > number (in concert with TIMESTAMP - so it was TIMESTAMP.PID). > > Our goal is to find a replacement function that is extremely cheap > (cheaper than say, random(1000000)) and will never repeat. Any ideas? > Has anyone else faced this problem?
I use $$.$r->uri().$connections.time where $connections is an incremental value defined before sub handler {...} and do $connections++ w/in the handler block (also realizing that you're porting CGI's and will have to get the uri elsewhere). For example: package foo; my $connections = 0; sub handler { my $r = shift ; ... ... ... my $unique_id = $$ . $r->uri() . $connections . time ; ... ... ... $connections++ ; } 1; Regards, Dave http://www.linkreminder.com