Apache::Singleton

miyagawa on 2001-12-24T23:46:16

Recently I've worked with Singleton module for mod_perl environment.

Something which bothers me with Class::Singleton is lifetime of singleton object. We use singleton pattern for config parser object, but in mod_perl environment, object stays the same even if we change configuration file. It's messy.

So Apache::Singleton clears out singleton instance on every request using Apache pnotes API. Original idea by Matt Sergeant on mod_perl list.

Newest 0.05 can switch to default Request or Process properly according to $ENV{MOD_PERL}, so it's totally compatible with Class::Singleton.