in reply to Re^2: Multiple Inheritance - Howto marry tie::refhash::nestable with class::singleton
in thread Multiple Inheritance - Howto marry tie::refhash::nestable with class::singleton

What speaks against a global variable keeping all information needed anywhere in the code?

merlyn isn't saying you shouldn't have a global repository for information. What he is saying is that you should be exporting functions/methods that the code can call to access said information. Then, if you ever need to log something or modify something as it's being set or retrieved, you have one place to do that. Or, let's say you're moving from a file-based system to a DB-based system.

Bite the bullet and change everything to a pure singleton and call the methods to get at or set the data. This is even more important with setting data. (Though, this is starting to sound more like a stash vs. a configuration object ...)


  • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
  • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"
  • Comment on Re^3: Multiple Inheritance - Howto marry tie::refhash::nestable with class::singleton