Revision history for Perl extension MooseX-Singleton
+0.05 2008-02-03
+ - avoid re-BUILD-ing existing singleton objects
+
0.04 2008-01-27
- exception when ->new called with args and instance already init'd (rjbs)
- - added ->initialize method to remove any ambiguity with ->new
+ - added ->initialize method to remove any ambiguity with ->new (rjbs)
0.03 2007-12-16
- reimplementation as a metaclass (Sartak)
my $existing = $class->meta->existing_singleton;
confess "Singleton is already initialized" if $existing and @args;
+ # Otherwise BUILD will be called repeatedly on the existing instance.
+ # -- rjbs, 2008-02-03
+ return $existing if $existing and ! @args;
+
return $class->SUPER::new(@args);
}