
NCGI::Singleton - Singleton object for persistent CGI environments

# In your package package MyPackage; use base 'NCGI::Singleton'; # In scripts, other modules, wherever use MyPackage; my $obj = MyPackage->instance();

NCGI::Singleton is an implementation of Class::Singleton that works in persistent Perl environments such as mod_perl and SpeedyCGI. It is drop-in-replaceable with Class::Singleton so nothing else is documented here.
The reason Class::Singleton doesn't work (as I would like it to) is because it relies on the existence of a global variable in a package. Since globals are not deleted for each CGI request it is not easy to have singletons that only exist for the length of a CGI request.

Returns the singleton, creating it if it doesn't already exist.


Mark Lawrence <nomad@null.net>

Copyright (C) 2005-2007 Mark Lawrence <nomad@null.net>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.