1Config::Model::Dumper(3U)ser Contributed Perl DocumentatiCoonnfig::Model::Dumper(3)
2
3
4
6 Config::Model::Dumper - Serialize data of config tree
7
9 version 1.205
10
12 use Config::Model ;
13
14 # create your config model
15 my $model = Config::Model -> new ;
16 $model->create_config_class( ... ) ;
17
18 # create instance
19 my $inst = $model->instance (root_class_name => 'FooBar',
20 instance_name => 'test1');
21
22 # create root of config
23 my $root = $inst -> config_root ;
24
25 # put some data in config tree
26 my $step = 'std_id:ab X=Bv - std_id:bc X=Av - a_string="toto tata"';
27 $root->walk( step => $step ) ;
28
29 # dump only customized data (audit mode)
30 print $root->dump_tree;
31
32 # dump all data including default values
33 print $root->dump_tree( full_dump => 1 ) ;
34
36 This module is used directly by Config::Model::Node to serialize
37 configuration data in a compact (but readable) string.
38
39 The serialisation can be done in standard mode where only customized
40 values are dumped in the string. I.e. only data modified by the user
41 are dumped.
42
43 The other mode is "full_dump" mode where all all data, including
44 default values, are dumped.
45
46 The serialized string can be used by Config::Model::Walker to store the
47 data back into a configuration tree.
48
49 Note that undefined values are skipped for list element. I.e. if a list
50 element contains "('a',undef,'b')", the dump will contain 'a','b'.
51
53 new ( )
54 No parameter. The constructor should be used only by
55 Config::Model::Node.
56
58 dump_tree
59 Return a string that contains a dump of the object tree with all the
60 values. This string follows the convention defined by
61 Config::Model::Walker.
62
63 The serialized string can be used by Config::Model::Walker to store the
64 data back into a configuration tree.
65
66 Parameters are:
67
68 mode ( full | preset | custom )
69 "full" will dump all configuration data including default values.
70
71 "preset" will dump only value entered in preset mode.
72
73 By default, the dump contains only data modified by the user (i.e.
74 "custom" data that differ from default or preset values).
75
76 node
77 Reference to the Config::Model::Node object that is dumped. All
78 nodes and leaves attached to this node are also dumped.
79
80 skip_auto_write ( <backend_name> )
81 Skip node that have a write capability matching "backend_name" in
82 their model. See Config::Model::AutoRead.
83
84 auto_vivify
85 Scan and create data for nodes elements even if no actual data was
86 stored in them. This may be useful to trap missing mandatory
87 values. (default: 0)
88
89 experience ( ... )
90 Restrict dump to "beginner" or "intermediate" parameters. Default
91 is to dump all parameters ("master" level)
92
94 Dominique Dumont, (ddumont at cpan dot org)
95
97 Config::Model,Config::Model::Node,Config::Model::Walker
98
99
100
101perl v5.12.1 2010-08-18 Config::Model::Dumper(3)