in reply to Re: Re: Re: Can I Create A Persistent Flock Under CGI.pm?
in thread Can I Create A Persistent Flock Under CGI.pm?
# How I've seen it suggested use MD5; sub generate_id { return substr(MD5->hexhash(time(). {}. rand(). $$. 'blah'), 0, 16) +; } # Is this better or overkill? use Time::HiRes qw(gettimeofday usleep); use Digest::MD5 qw(md5_hex); sub generate_sessionID { my ($s, $usec) = gettimeofday; # Get time of day in seconds and + useconds usleep(1); # Sleep for one usec so a persistant process can't c +all it twice in a usec (for mod_perl) # Sessionkey is MD5 hash of seconds_since_epoch+usecs+process_id+r +andom return substr(md5_hex($s.$usec.$$.rand()), 0, 32); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Can I Create A Persistent Flock Under CGI.pm?
by sierrathedog04 (Hermit) on May 30, 2001 at 02:11 UTC | |
by shotgunefx (Parson) on May 30, 2001 at 02:24 UTC |