I really don't buy this "singletons sucks" stuff, at least for configuration object :)
For me the problem is that if there are dozens of:
my $config = MySingletonConfigurationClass->instance; my ($foo, $bar) = ( $config->foo, $config->bar );
sprinkled all around my code overriding things for testing, tweaking configuration based on the context, etc. all become much harder than if I'd passed in my own configuration object, used dependency injection, or whatever.
Most people seem to use singletons as big-fat-globals in disguise - and give themselves (or the poor souls who have to maintain their code) all the problems that globals give you.
Take a look at http://del.icio.us/adrianh/singleton for some singleton rants.
In reply to Re^8: what is a propper way to make a chunk of data accessible to all my packages for retrieval and modification ?
by adrianh
in thread what is a propper way to make a chunk of data accessible to all my packages for retrieval and modification ?
by leocharre
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |