[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: config file tool

Justin Pryzby <justin@aavso.org> writes:

>> I've written a tool that enable you to extract the information from
>> configuration files, check the data and write it back.
> Can you just extract the data too?

With a little modif of the main program, yes.

Now, the question is what you want to do with the data ? Display it ?
Store it in another format ? Audit it ? (I.e. compare actual vs
default value)

> I'm interested in hearing more.

The core of this tool is the configuration model where you describe
the content and constraints of your configuration data. This model is
used by Config::Model Perl modules [1].

Depending on your target configuration, the work needed to create this
model can be simple or quite complex. (I've provided with
Config::Model an example for /etc/fstab [2] )

With Config::Model and a model, you have a tool to create an tree
representation of your data (often referred as "configuration tree" in
the doc). You also have a way to check the consistency of your data in
the configuration tree.

Config::Model also provide a user interface. Currently there's only a
basic "readline" interface. A curse interface is on its way.

Now, there the problem of assigning data in the configuration
tree. For this you need to write a parser which will depend on the
syntax of your configuration file. If the structure of the file
matches the structure of the configuration model, this parser can be

If you only want to check data, a writer is not needed.

For more information, you can check the homepage on sourceforge [4]
(which needs a rework).

If you want to see a real life configuration model, you can look at
the model for xorg.conf [3] (which is in the complex range :-p ). Note
that this work is still experimental.

To get people started, I'm willing to help create model parser and
writer for simple configuration.


[1] http://search.cpan.org/dist/Config-Model/
[2] http://search.cpan.org/src/DDUMONT/Config-Model-0.607/examples/fstab/Fstab.pl
[3] http://search.cpan.org/dist/Config-Model-Xorg/
[4] http://config-model.sourceforge.net/

Dominique Dumont 
"Delivering successful solutions requires giving people what they
need, not what they want." Kurt Bittner

Reply to: