The stupid question is the question not asked | |
PerlMonks |
Handling configuration for multiple modulesby jhourcle (Prior) |
on Apr 08, 2005 at 02:57 UTC ( [id://445934]=perlquestion: print w/replies, xml ) | Need Help?? |
jhourcle has asked for the wisdom of the Perl Monks concerning the following question: I'm currently working on a mid-sized project (4 programmers, with 14 components, in 42 scripts and 53 Perl modules, not including stuff from CPAN). Due to the nature of the application, different servers may have one or more of the components installed. We've attempted to move server specific variables to a configuration module, from which the other modules can get their necessary information. Each of the modules that use the configuration module need to have a chance to register their variables with the configuration module when they're installed. ... And that's where I'm running into problems. I currently call an 'AddVariable' function from within Makefile.PL:
(I don't think the actual code for storing the variable is significant to the question, as it's more a logic thing, but if you want, I can provide that, too.) And so we get to the real problem -- how would you handle the configuration such that it's available for a 'make test', but not seen by any other module until you do a 'make install'? I'm currently storing the configuration info in an xml file in the same directory as the configuration module:
I've trimmed out the majority of the module, but it should give you the basic idea. Basically, we couldn't decide how to access the values, so some are importing them as constants, others create a config object, etc -- and there are functions to export the configuration as XML, C headers, or shell scripts ... %CONFIG holds the language indendent items. My current thoughts on how to handle the problem include --
Are there any better suggestions, either for the narrow problem, or to replace my whole configuration logic?
Back to
Seekers of Perl Wisdom
|
|