1Config::Model::Itself(3U)ser Contributed Perl DocumentatiCoonnfig::Model::Itself(3)
2
3
4
6 Config::Model::Itself - Model editor for Config::Model
7
9 version 2.016
10
12 # Itself constructor returns an object to read or write the data
13 # structure containing the model to be edited
14 my $meta_model = Config::Model::Itself -> new( ) ;
15
16 # now load the model to be edited
17 $meta_model -> read_all( ) ;
18
19 # For Curses UI prepare a call-back to write model
20 my $wr_back = sub { $meta_model->write_all(); }
21
22 # create Curses user interface
23 my $dialog = Config::Model::CursesUI-> new (
24 store => $wr_back,
25 ) ;
26
27 # start Curses dialog to edit the mode
28 $dialog->start( $meta_model->config_root ) ;
29
30 # that's it. When user quits curses interface, Curses will call
31 # $wr_back sub ref to write the modified model.
32
34 Config::Itself module and its model files provide a model of
35 Config:Model (hence the Itself name).
36
37 Let's step back a little to explain. Any configuration data is, in
38 essence, structured data. A configuration model is a way to describe
39 the structure and relation of all items of a configuration data set.
40
41 This configuration model is also expressed as structured data. This
42 structure data follows a set of rules which are described for humans in
43 Config::Model.
44
45 The structure and rules documented in Config::Model are also expressed
46 in a model in the files provided with "Config::Model::Itself".
47
48 Hence the possibity to verify, modify configuration data provided by
49 Config::Model can also be applied on configuration models. Using the
50 same user interface.
51
52 From a Perl point of view, Config::Model::Itself provides a class
53 dedicated to read and write a set of model files.
54
56 new ( [ cm_lib_dir => ... ] )
57 Creates a new read/write handler. If no model_object is passed, the
58 required objects are created. "cm_lib_dir" specifies where are the
59 model files (defaults to "./lib/Config/Model".
60
61 "cm_lib_dir" is either a "Path::Tiny" object or a string.
62
63 By default, this constructor will create all necessary "Config::Model*"
64 objects. If needed, you can pass already created object with options
65 "config_model" (Config::Model object), "meta_instance"
66 (Config::Model::Instance object) or "meta_root" (Config::Model::Node
67 object).
68
69 Methods
71 Load all the model files contained in "model_dir" and all its
72 subdirectories. "root_model" is used to filter the classes read.
73
74 Use "force_load" if you are trying to load a model containing errors.
75
76 "read_all" returns a hash ref containing ( class_name => file_name ,
77 ...)
78
79 write_all
80 Will write back configuration model in the specified directory. The
81 structure of the read directory is respected.
82
83 write_model_plugin( plugin_dir => foo, plugin_name => bar )
84 Write plugin models in the passed "plugin_dir" directory. The written
85 file is path is made of plugin name and class names. E.g. a plugin
86 named "bar" for class "Foo::Bar" is written in "bar/Foo/Bar.pl" file.
87 This file is to be used by augment_config_class '...', class_data )">
88
89 read_model_plugin( plugin_dir => foo, plugin_name => bar.pl )
90 This method searched recursively "$plugin_dir/$plugin_name" and load
91 all "*.pl" files found there.
92
93 list_class_element
94 Returns a string listing all the class and elements. Useful for
95 debugging your configuration model.
96
97 get_dot_diagram
98 Returns a graphviz dot file that represents the structure of the
99 configuration model:
100
101 · "include" relations are represented by solid lines
102
103 · Class usage (i.e. "config_class_name" parameter) is represented by
104 dashed lines. The name of the element is attached to the dashed
105 line.
106
108 Test menu entries are created from the content of "application" model
109 parameter. Unfortunately, there's no way to build the menu
110 dynamically. So user cme must be restarted to change the menu if the
111 application list is changed.
112
114 Config::Model, Config::Model::Node, Path::Tiny
115
117 Dominique Dumont
118
120 This software is Copyright (c) 2007-2018 by Dominique Dumont.
121
122 This is free software, licensed under:
123
124 The GNU Lesser General Public License, Version 2.1, February 1999
125
127 Websites
128 The following websites have more information about this module, and may
129 be of help to you. As always, in addition to those websites please use
130 your favorite search engine to discover more resources.
131
132 · Search CPAN
133
134 The default CPAN search engine, useful to view POD in HTML format.
135
136 <http://search.cpan.org/dist/Config-Model-Itself>
137
138 · AnnoCPAN
139
140 The AnnoCPAN is a website that allows community annotations of Perl
141 module documentation.
142
143 <http://annocpan.org/dist/Config-Model-Itself>
144
145 · CPAN Ratings
146
147 The CPAN Ratings is a website that allows community ratings and
148 reviews of Perl modules.
149
150 <http://cpanratings.perl.org/d/Config-Model-Itself>
151
152 · CPANTS
153
154 The CPANTS is a website that analyzes the Kwalitee ( code metrics )
155 of a distribution.
156
157 <http://cpants.cpanauthors.org/dist/Config-Model-Itself>
158
159 · CPAN Testers
160
161 The CPAN Testers is a network of smoke testers who run automated
162 tests on uploaded CPAN distributions.
163
164 <http://www.cpantesters.org/distro/C/Config-Model-Itself>
165
166 · CPAN Testers Matrix
167
168 The CPAN Testers Matrix is a website that provides a visual
169 overview of the test results for a distribution on various
170 Perls/platforms.
171
172 <http://matrix.cpantesters.org/?dist=Config-Model-Itself>
173
174 · CPAN Testers Dependencies
175
176 The CPAN Testers Dependencies is a website that shows a chart of
177 the test results of all dependencies for a distribution.
178
179 <http://deps.cpantesters.org/?module=Config::Model::Itself>
180
181 Bugs / Feature Requests
182 Please report any bugs or feature requests by email to "ddumont at
183 cpan.org", or through the web interface at
184 <https://github.com/dod38fr/config-model-itself/issues>. You will be
185 automatically notified of any progress on the request by the system.
186
187 Source Code
188 The code is open to the world, and available for you to hack on. Please
189 feel free to browse it and play with it, or whatever. If you want to
190 contribute patches, please send me a diff or prod me to pull from your
191 repository :)
192
193 <http://github.com/dod38fr/config-model-itself>
194
195 git clone git://github.com/dod38fr/config-model-itself.git
196
197
198
199perl v5.28.1 2019-02-02 Config::Model::Itself(3)