Config::Model::Itself - Model editor for Config::Model
version 2.008
# Itself constructor returns an object to read or write the data # structure containing the model to be edited my $meta_model = Config::Model::Itself -> new( ) ; # now load the model to be edited $meta_model -> read_all( ) ; # For Curses UI prepare a call-back to write model my $wr_back = sub { $meta_model->write_all(); } # create Curses user interface my $dialog = Config::Model::CursesUI-> new ( store => $wr_back, ) ; # start Curses dialog to edit the mode $dialog->start( $meta_model->config_root ) ; # that's it. When user quits curses interface, Curses will call # $wr_back sub ref to write the modified model.
Config::Itself module and its model files provide a model of Config:Model (hence the Itself name).
Let's step back a little to explain. Any configuration data is, in essence, structured data. A configuration model is a way to describe the structure and relation of all items of a configuration data set.
This configuration model is also expressed as structured data. This structure data follows a set of rules which are described for humans in Config::Model.
The structure and rules documented in Config::Model are also expressed in a model in the files provided with Config::Model::Itself.
Config::Model::Itself
Hence the possibity to verify, modify configuration data provided by Config::Model can also be applied on configuration models. Using the same user interface.
From a Perl point of view, Config::Model::Itself provides a class dedicated to read and write a set of model files.
Creates a new read/write handler. If no model_object is passed, the required objects are created. cm_lib_dir specifies where are the model files (defaults to ./lib/Config/Model.
cm_lib_dir
./lib/Config/Model
cm_lib_dir is either a Path::Tiny object or a string.
Path::Tiny
By default, this constructor will create all necessary Config::Model* objects. If needed, you can pass already created object with options config_model (Config::Model object), meta_instance (Config::Model::Instance object) or meta_root (Config::Model::Node object).
Config::Model*
config_model
meta_instance
meta_root
Load all the model files contained in model_dir and all its subdirectories. root_model is used to filter the classes read.
model_dir
root_model
Use force_load if you are trying to load a model containing errors.
force_load
read_all returns a hash ref containing ( class_name => file_name , ...)
read_all
Will write back configuration model in the specified directory. The structure of the read directory is respected.
Write plugin models in the passed plugin_dir directory. The written file is path is made of plugin name and class names. E.g. a plugin named bar for class Foo::Bar is written in bar/Foo/Bar.pl file. This file is to be used by augment_config_class '...', class_data )">
plugin_dir
bar
Foo::Bar
bar/Foo/Bar.pl
This method searched recursively $plugin_dir/$plugin_name and load all *.pl files found there.
$plugin_dir/$plugin_name
*.pl
Returns a string listing all the class and elements. Useful for debugging your configuration model.
Returns a graphviz dot file that represents the structure of the configuration model:
include relations are represented by solid lines
include
Class usage (i.e. config_class_name parameter) is represented by dashed lines. The name of the element is attached to the dashed line.
config_class_name
Test menu entries are created from the content of application model parameter. Unfortunately, there's no way to build the menu dynamically. So user cme must be restarted to change the menu if the application list is changed.
application
Config::Model, Config::Model::Node, Path::Tiny
Dominique Dumont
This software is Copyright (c) 2007-2017 by Dominique Dumont.
This is free software, licensed under:
The GNU Lesser General Public License, Version 2.1, February 1999
The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.
Search CPAN
The default CPAN search engine, useful to view POD in HTML format.
http://search.cpan.org/dist/Config-Model-Itself
AnnoCPAN
The AnnoCPAN is a website that allows community annotations of Perl module documentation.
http://annocpan.org/dist/Config-Model-Itself
CPAN Ratings
The CPAN Ratings is a website that allows community ratings and reviews of Perl modules.
http://cpanratings.perl.org/d/Config-Model-Itself
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
http://cpants.cpanauthors.org/dist/Config-Model-Itself
CPAN Testers
The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions.
http://www.cpantesters.org/distro/C/Config-Model-Itself
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
http://matrix.cpantesters.org/?dist=Config-Model-Itself
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
http://deps.cpantesters.org/?module=Config::Model::Itself
Please report any bugs or feature requests by email to ddumont at cpan.org, or through the web interface at https://github.com/dod38fr/config-model-itself/issues. You will be automatically notified of any progress on the request by the system.
ddumont at cpan.org
The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)
http://github.com/dod38fr/config-model-itself
git clone git://github.com/dod38fr/config-model-itself.git
To install Config::Model::Itself, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::Model::Itself
CPAN shell
perl -MCPAN -e shell install Config::Model::Itself
For more information on module installation, please visit the detailed CPAN module installation guide.