hi list,
i'm about to start writing the first of a series of internal modules,
aimed at handling common features among sites we develop. Like, let's
say, a 'latest news' box or a product guide/database.
Now, the idea is to have one codebase, written in a module that serves
all of our sites. Each site should have its own (rather complex) config.
Each and every subroutine must know in which context it's being called,
and I don't really want to pass the config as a parameter to every
damned sub.
Currently, I keep the configs as a global hash inside the module,
that's good when you've got one module per implementation. I won't scale
further justlike that.
Maybe I should have a hash inside the module, with the $ENV{HTTP_HOST}
or $ENV{'SERVER_NAME'} as key and the configs as values. Maybe this same
setup in a mysql table. But that'd allow only one implementation of each
module per domain. And I think that maybe I'll someday need, say, 2
product guides (under different brands) in the same site / page.
So that's not 'THE' way. Maybe something intermediate. But I don't
really know how. Does anyone want to share his views on this?
Maybe I could build a wrapper module, that manages the configs and sets
them up in the environment. That'd be nice to post in CPAN.
martin