1Config::Model::Report(3U)ser Contributed Perl DocumentatiCoonnfig::Model::Report(3)
2
3
4
6 Config::Model::Report - Reports data from config tree
7
9 version 2.138
10
12 use Config::Model;
13
14 # define configuration tree object
15 my $model = Config::Model->new;
16 $model->create_config_class(
17 name => "Foo",
18 element => [
19 [qw/foo bar/] => {
20 type => 'leaf',
21 value_type => 'string'
22 },
23 ],
24 description => [
25 foo => 'some foo explanation',
26 bar => 'some bar explanation',
27 ]
28 );
29
30 $model->create_config_class(
31 name => "MyClass",
32
33 element => [
34
35 [qw/foo bar/] => {
36 type => 'leaf',
37 value_type => 'string'
38 },
39 my_enum => {
40 type => 'leaf',
41 value_type => 'enum',
42 choice => [qw/A B C/],
43 help => {
44 A => 'first letter',
45 B => 'second letter',
46 C => 'third letter',
47 },
48 description => 'some letters',
49 },
50 hash_of_nodes => {
51 type => 'hash', # hash id
52 index_type => 'string',
53 cargo => {
54 type => 'node',
55 config_class_name => 'Foo'
56 },
57 },
58 ],
59 );
60
61 my $inst = $model->instance(root_class_name => 'MyClass' );
62
63 my $root = $inst->config_root ;
64
65 # put data
66 my $steps = 'foo=FOO my_enum=B hash_of_nodes:fr foo=bonjour -
67 hash_of_nodes:en foo=hello ';
68 $root->load( steps => $steps );
69
70 print $root->report ;
71 # foo = FOO
72 #
73 # my_enum = B
74 # DESCRIPTION: some letters
75 # SELECTED: second letter
76 #
77 # hash_of_nodes:en foo = hello
78 # DESCRIPTION: some foo explanation
79 #
80 # hash_of_nodes:fr foo = bonjour
81 # DESCRIPTION: some foo explanation
82
84 This module is used directly by Config::Model::Node to provide a human
85 readable report of the configuration. This report includes the
86 configuration values and (if provided by the model) the description of
87 the configuration item and their effect.
88
89 A "report" shows "all" configuration items. An "audit" shows only
90 configuration items which are different from their default value.
91
93 new
94 No parameter. The constructor should be used only by
95 Config::Model::Node.
96
98 report
99 Returns a string containing the configuration values and (if provided
100 by the model) the description of the configuration item and their
101 effect.
102
103 Parameters are:
104
105 audit
106 Set to 1 to report only configuration data different from default
107 values. Default is 0.
108
109 node
110 Reference to the Config::Model::Node object that is dumped. All
111 nodes and leaves attached to this node are also dumped.
112
114 Dominique Dumont, (ddumont at cpan dot org)
115
117 Config::Model,Config::Model::Node,Config::Model::Walker
118
120 Dominique Dumont
121
123 This software is Copyright (c) 2005-2019 by Dominique Dumont.
124
125 This is free software, licensed under:
126
127 The GNU Lesser General Public License, Version 2.1, February 1999
128
129
130
131perl v5.30.1 2020-01-29 Config::Model::Report(3)