Click here to get back home

RFC: Bridge AppConfig and Config::Model

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
RFC: Bridge AppConfig and Config::Model Dominique Dumont 11-22-2007
Posted by Dominique Dumont on November 22, 2007, 7:33 am
Please log in for more thread options

Hello

I've had a request to be able to use Config::Model [1] on top of
AppConfig [2] to have an easy configuration editor
(Config:::Model::CursesUI [3])

To provide a configuration editor, Config::Model needs a description
(i.e. a model) of the configuration variables.

AppConfig also have its own representation of configuration variables
(constructed with AppConfig::define method).

Currently, I can see 2 ways of using AppConfig and Config::Model:

1. Rely on AppConfig representation and create a valid model for
Config::Model
2. Start from a valid Config::Model, and hook AppConfig so that each
new variable setting is checked by Config::Model. The hook would
use VALIDATE with a code ref.

Solution 1 needs:
- code to convert AppConfig data structure to Config::Model data
structure.
- code to read config data from AppConfig and load it into the
configuration instance created with Config::Model
- code to write back config value modifed by the editor into AppConfig

Solution 2 needs:
- A valid model for Config::Model (taking into account AppConfig
limitations)
- some code to create AppConfig data structure from the "valid model"
mentioned above.
- The same read/write code as solution 1

* sol 1 Pro & Cons:
+ Quite transparent to developer
- No validation besides the one done by AppConfig
- No help for each parameter
* sol 2 Pro & Cons:
- developer must write a config model (taking into account the
structure that can be mapped to AppConfig, mostly a unique config
class with leaf, list or hash elements)
+ developer can add more validation criteria
+ developer can add help for parameters

Anyway, I think I can provide both modes in a module named (If Andy
agrees) AppConfig::ToConfigModel.

What do you think ?

Do you have other suggestion for a module name ?

Should I provide the 2 solutions in 2 modules ? Like
AppConfig::ToConfigModel and AppConfig::FromConfigModel.

Thanks for any feedback

[1] http://config-model.wiki.sourceforge.net/
http://search.cpan.org/dist/Config-Model/

[2] http://search.cpan.org/~abw/AppConfig-1.66/

[3] http://freshmeat.net/projects/config-model-cursesui/
http://search.cpan.org/dist/Config-Model-CursesUI/

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

Similar ThreadsPosted
New release of Config-Model, first draft for Xorg model September 11, 2006, 8:08 am
New release of Config-Model, first draft for Xorg model September 11, 2006, 8:08 am
New release of Config-Model, first draft for Xorg model September 24, 2006, 11:22 am
[ANNOUNCE] Config::Model - Framework for semantic validation of config data March 20, 2006, 10:07 am
New release of Config::Model with fstab model example May 22, 2006, 8:08 am
New release of Config-Model July 24, 2006, 8:20 am
New release of Config::Model v 0.612 August 4, 2007, 11:43 am
New version of Config::Model (v0.615) November 16, 2007, 7:43 am
ANNOUNCE: Curses interface for Config::Model May 15, 2007, 7:20 am
New version of Config::Model (v0.616): INI file support December 6, 2007, 1:06 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap