I have had a problem for quite sometime with some code. We refer to the code as the poor mans configuration management system. (the code snippets below have been shortened to not reflect the name space of the client in question).
All in all it is a CPAN like distribution of files.
Configuration_DEV.pm
Configuration_TEST.pm
Configuration_PROD.pm
The 3 files contain several package definitions, one per application and so forth.
The configurations then vary according to their environments. DEV, TEST and PROD.
So I have subclassed Module::Build and implemented my own install action.
This action reacts to a mandatory commandline argument, so the user has to decide on what environment he/she wants to install.
So if the user specifies test, the installation creates a symlink called Configuration.pm
in the install directory pointing to the designated environment specific file.
And everybody is happy.
Or?
My problem is that we constantly add a lot of configurable parameters in these files and new package definitions.
So in order to control this I normally specify what version my new or improved application requires as a minimum in my application's Build.PL
.
But the $VERSION
has to be defined in all 3 files and even the distributions Build.PL
wants it. So I added a VERSION.pm
file, which only contained the version.
This works ok, apart from the fact that Module::Build would not recognize and parse the line where I included it in the $VERSION = $VERSION:VERSION;
I have adressed this problem of mine with many fellow Perl mongers, but without any resolution.
I have never been really active on Perlmonks, but yesterday I thought, hey why don't I ask there?
The next day I had two responses to my inquiry
None of these was quite what I was looking for at first, but one of them got me thinking.
So I added yet another action to my Module::Build subclass, so now the version of the distribution is controlled in the Build.PL and the ./Build dist
action puts the proper version into all of the environment files in the distribution.
The solution has some minor cosmetic problems, such as the code is changed prior to shipping and does therefor not reflect the code in CVS completely.
But my problem went away and to quote, or I cannot remember the exact quote, but Damian Conway once said that the Perl community was a... lucky/rich something community to have something like Perlmonks.
I can only agree.
Perhaps I should boil my whole poor mans configuration management system down to a writeup on Perlmonks, perhaps somebody else can use it.