Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: unique cookie id?by cees (Curate) |
on Dec 23, 2003 at 17:51 UTC ( [id://316664]=note: print w/replies, xml ) | Need Help?? |
Since you are using mod_perl, you might as well use apache's mod_unique_id to generate unique IDs for you. From the docs: This module provides a magic token for each request which is guaranteed to be unique across "all" requests under very specific conditions. The unique identifier is even unique across multiple machines in a properly configured cluster of machines. The environment variable UNIQUE_ID is set to the identifier for each request. Every request will have $ENV{UNIQUE_ID} set to a unique value. If for some reason you do not have access to use this module, then you can look at the source code for the implementation that they use to generate a unique ID in an apache environment (remember that in mod_perl2 you may have to deal with a threaded environment). Update: Just remembered, have a look at Apache::Session::Generate::MD5 for a mechanism similar to yours that Apache::Session uses to generate Session IDs. I would still recommend going with mod_unique_id, but this could be an option for you as well. Please note that you do not need to use Apache::Session in order to use Apache::Session::Generate::MD5... - Cees
In Section
Seekers of Perl Wisdom
|
|