A singleton is a class that has only one instance in an application. MooseX::Singleton lets you easily upgrade (or downgrade, as it were) your Moose class to a singleton.

All you should need to do to transform your class is to change use Moose to use MooseX::Singleton. This module uses metaclass roles to do its magic, so it should cooperate with most other MooseX modules.

This returns the singleton instance for the given package. This method does not accept any arguments. If the instance does not yet exist, it is created with its defaults values. This means that if your singleton requires arguments, calling instance will die if the object has not already been initialized.

This method currently works like a hybrid of initialize and instance. However, calling new directly will probably be deprecated in a future release. Instead, call initialize or instance as appropriate.

Please report any bugs or feature requests to bug-moosex-singleton@rt.cpan.org, or through the web interface at http://rt.cpan.org. We will be notified, and then you'll automatically be notified of progress on your bug as we make changes.