1Config::Model::Loader(3U)ser Contributed Perl DocumentatiCoonnfig::Model::Loader(3)
2
3
4
6 Config::Model::Loader - Load serialized data into 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->load( step => $step ) ;
28
30 This module is used directly by Config::Model::Node to load serialized
31 configuration data into the configuration tree.
32
33 Serialized data can be written by the user or produced by
34 Config::Model::Dumper while dumping data from a configuration tree.
35
37 new ( )
38 No parameter. The constructor should be used only by
39 Config::Model::Node.
40
42 The string is made of the following items separated by spaces:
43
44 - Go up one node
45
46 ! Go to the root node of the configuration tree.
47
48 xxx Go down using "xxx" element. (For "node" type element)
49
50 xxx:yy Go down using "xxx" element and id "yy" (For "hash" or "list"
51 element with "node" cargo_type)
52
53 xxx=~/yy/
54 Go down using "xxx" element and loop over the ids that match
55 the regex. (For "hash")
56
57 For instance, with OpenSsh model, you could do
58
59 Host=~/.*.debian.org/ user='foo-guest'
60
61 to set "foo-user" users for all your debian accounts.
62
63 xxx~yy Delete item referenced by "xxx" element and id "yy". For a
64 list, this is equivalent to "splice xxx,yy,1". This command
65 does not go down in the tree (since it has just deleted the
66 element). I.e. a '"-"' is generally not needed afterwards.
67
68 xxx=zz Set element "xxx" to value "yy". load also accepts to set
69 elements with a quoted string. (For "leaf" element)
70
71 For instance "foo="a quoted string"". Note that you cannot
72 embed double quote in this string. I.e "foo="a \"quoted\"
73 string"" will fail.
74
75 "foo=''" will set foo to "undef".
76
77 xxx=z1,z2,z3
78 Set list element "xxx" to list "z1,z2,z3". Use ",," for undef
79 values, and "" for empty values.
80
81 I.e, for a list "('a',undef,'','c')", use "a,,"",c".
82
83 xxx:yy=zz
84 For "hash" element containing "leaf" cargo_type. Set the leaf
85 identified by key "yy" to value "zz".
86
87 Using "xxx=~/yy/=zz" is also possible.
88
89 xxx.=zzz
90 Will append "zzz" value to current values (valid for "leaf"
91 elements).
92
93 xxx#zzz or xxx:yyy#zzz
94 Element annotation. Can be quoted or not quoted.
95
97 load ( ... )
98 Load data into the node tree (from the node passed with "node") and
99 fill values as we go following the instructions passed with "step".
100 ("step" can also be an array ref).
101
102 Parameters are:
103
104 node
105 node ref of the root of the tree (of sub-root) to start the load
106 from.
107
108 step
109 A string or an array ref containing the steps to load. See above
110 for a description of the string.
111
112 experience
113 Specify the experience level used during the load (default:
114 "master"). The experience can be "intermediate advanced master".
115 The load will raise an exception if the step of the load string
116 tries to access an element with experience higher than user's
117 experience.
118
120 Dominique Dumont, (ddumont at cpan dot org)
121
123 Config::Model,Config::Model::Node,Config::Model::Dumper
124
125
126
127perl v5.12.1 2010-08-18 Config::Model::Loader(3)