1Config::Model::Itself(3U)ser Contributed Perl DocumentatiCoonnfig::Model::Itself(3)
2
3
4
6 Config::Model::Itself - Model (or schema) editor for Config::Model
7
9 version 2.023
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 Here's the list of people who helped improve this project:
115
116 Gregor Herrmann
117
118 Thanks for the patches !
119
121 Config::Model, Config::Model::Node, Path::Tiny
122
124 Dominique Dumont
125
127 This software is Copyright (c) 2007-2019 by Dominique Dumont.
128
129 This is free software, licensed under:
130
131 The GNU Lesser General Public License, Version 2.1, February 1999
132
134 Websites
135 The following websites have more information about this module, and may
136 be of help to you. As always, in addition to those websites please use
137 your favorite search engine to discover more resources.
138
139 • CPANTS
140
141 The CPANTS is a website that analyzes the Kwalitee ( code metrics )
142 of a distribution.
143
144 <http://cpants.cpanauthors.org/dist/Config-Model-Itself>
145
146 • CPAN Testers
147
148 The CPAN Testers is a network of smoke testers who run automated
149 tests on uploaded CPAN distributions.
150
151 <http://www.cpantesters.org/distro/C/Config-Model-Itself>
152
153 • CPAN Testers Matrix
154
155 The CPAN Testers Matrix is a website that provides a visual
156 overview of the test results for a distribution on various
157 Perls/platforms.
158
159 <http://matrix.cpantesters.org/?dist=Config-Model-Itself>
160
161 • CPAN Testers Dependencies
162
163 The CPAN Testers Dependencies is a website that shows a chart of
164 the test results of all dependencies for a distribution.
165
166 <http://deps.cpantesters.org/?module=Config::Model::Itself>
167
168 Bugs / Feature Requests
169 Please report any bugs or feature requests by email to "ddumont at
170 cpan.org", or through the web interface at
171 <https://github.com/dod38fr/config-model-itself/issues>. You will be
172 automatically notified of any progress on the request by the system.
173
174 Source Code
175 The code is open to the world, and available for you to hack on. Please
176 feel free to browse it and play with it, or whatever. If you want to
177 contribute patches, please send me a diff or prod me to pull from your
178 repository :)
179
180 <http://github.com/dod38fr/config-model-itself>
181
182 git clone git://github.com/dod38fr/config-model-itself.git
183
184
185
186perl v5.36.0 2023-01-20 Config::Model::Itself(3)