http://qs321.pair.com?node_id=670323

arbingersys has asked for the wisdom of the Perl Monks concerning the following question:

I have a Perl/MySQL project called Sylbi, and it uses a configuration file, Config.pm, that contains such things as DBI connection strings, session settings, etc. I've noticed this before in other projects, but I'm noticing it acutely on this one: That I'm basically having to maintain several copies of Config.pm. One that's being actively developed and might have experimental changes in it, one that has sensitive authentication information for my online demo, and one with default, stable settings for inclusion in the distro.

So I think the problems are pretty obvious that come about with this kind of setup. (1) Redundant edits. If I add, remove, change anything significant in the dev Config.pm, I also have to make this change in the other files. (2) Memory faults. It's easy to forget to make the redundant changes, or even to copy the wrong file to the wrong place (i.e. my demo), causing failures all around. Also in this vein is the mere headache of remembering, after some time has elapsed since working on the project, where I stored the alternate Config.pm files, whether they each contain the appropriate settings, etc.

I can't imagine this is a new problem. How would/do the Monks handle this type of thing? Are there any tools out there that would provide a better, more intuitive way to manage a single file with different orientations?

Update: I should probably try and make myself a little more clear. I was thinking that it would great if within a single file (i.e. Config.pm), you could have sections defined that could then be omitted under certain build conditions. This would be especially helpful, I think, while in development. You would only have to edit a single file, and, as in the cases I outline above, some settings flagged experimental would be removed when building the distribution, or another section with some sensitive data would be included only if you were assembling the 'demo'. Are there any tools/techniques that lend themselves to this idea?

A blog among millions.