Re-implementation. This uses a bit of Moose meta magic to get real singletons.
authorShawn M Moore <sartak@gmail.com>
Sun, 16 Dec 2007 15:21:03 +0000 (15:21 +0000)
committerShawn M Moore <sartak@gmail.com>
Sun, 16 Dec 2007 15:21:03 +0000 (15:21 +0000)
commit109b110b1d5969c8ae2ec7a5e5d86066f895d828
treed189ee758009f60144774f709e7f8cfb6930c4a7
parent1467693305140ae67c90d332344ef89d02d91fa4
Re-implementation. This uses a bit of Moose meta magic to get real singletons.
The basic idea is you can now do:

package Moofty;
use MooseX::Singleton;
has 'config' => (is => 'rw', isa => 'HashRef');

package main;
my $moofty = Moofty->instance;
Moofty->config->{min_frob} = 10; # !!
print $moofty->config->{min_frob}; # 10
lib/MooseX/Singleton.pm
lib/MooseX/Singleton/Meta/Class.pm [new file with mode: 0644]
lib/MooseX/Singleton/Meta/Instance.pm [new file with mode: 0644]
lib/MooseX/Singleton/Object.pm [new file with mode: 0644]
t/001-basic.t [new file with mode: 0644]
t/singleton.t [deleted file]