[Catalyst] Re: using Plugin::Singleton and testing

Jules Bean jules at jellybean.co.uk
Fri Nov 24 10:28:30 GMT 2006


Daniel McBrearty wrote:
> And I don't see why a singleton is not a proper object; it hides it's
> implementation from the outside, encapsulates data and code, presents
> an API which can be used to control or restrict the way it is used,
> and so on. The fact that the number of instances is limited is neither
> here nor there. Are there no real world classes of objects of which
> there are only one instance?

Let's return to the case in point:

If you use a singleton pattern in ANY library which will be reused in a 
"mod_perl-style" context then it breaks, because there might be more 
than one completely separate application running in the same perl namespace.

And since ANY library in CPAN might be re-used in this context, you 
should never do it.

Case (IMO) closed.





More information about the Catalyst mailing list