Again I’m facing this problem. The small program I just wrote needs to be configurable with an unlimited amount of pairs, each pair consisting of two values. In my current implementation, the program is done in perl, the configuration file is just a normal perl file and the configuration is done by adding things to two perl arrays like this:
first configuration directive
push(@arr1, "first"); push(@arr2, "first other stuff");
second configuration directive
push(@arr1, "second"); push(@arr2, "second other stuff");
This makes it possible to do tricks, like parsing out the arguments given to the program into variables and then use them in the configuration directives. All this is really simple because the configuration file is just a normal perl script.
But, is this really usable and user-friendly? It is for me, who knows enough perl to get by.. I’m hoping that by providing a couple of examples at the top of the file it will be possible for someone who’s never seen perl before to write the configuration.
I just don’t see the point of inventing a configuration file syntax and making, a probably, complex parser for something that will likely be configured just once.
It’s hard to draw the line between easy to do and easy to use….