http://qs1969.pair.com?node_id=316641

rkg has asked for the wisdom of the Perl Monks concerning the following question:

Hi -- Can I be assured the following code generates a unique cookie id in a mod_perl environment?

ToBase62 just converts an int to base62 representation(A-Z,a-z,0-9).

Do I need to worry about different length pids?

Thanks

rkg

sub generate_id { my $id = $ToBase62->(time) . $ToBase62->($$) . ToBase62->( rand($$ +) ); return $id; }