1Config::Model::IdElemenUtsReerfeCroenntcrei(b3u)ted PerlCoDnofciugm:e:nMtoadteilo:n:IdElementReference(3)
2
3
4

NAME

6       Config::Model::IdElementReference - Refer to id element(s) and extract
7       keys
8

VERSION

10       version 1.205
11

SYNOPSIS

13        # used from a value class
14        element => [
15                   node_host => { type => 'leaf',
16                                  value_type => 'reference' ,
17                                  refer_to => '! host'
18                                },
19                   if   => { type => 'leaf',
20                             value_type => 'reference' ,
21                             computed_refer_to
22                             => { formula => '  ! host:$h if ',
23                                  variables => { h => '- node_host' }
24                                }
25                           },
26                   ],
27
28         # used from checklist
29         element => [
30                     # simple reference, checklist items are given by the
31                     # keys of my_hash
32                     refer_to_list => { type => 'check_list',
33                                        refer_to => '- my_hash'
34                                      },
35
36                     # checklist items are given by combining my_hash*
37                     refer_to_2_list
38                                   => { type => 'check_list',
39                                        refer_to => '- my_hash + - my_hash2   + - my_hash3'
40                                      },
41                    ]
42

DESCRIPTION

44       This class is user by Config::Model::Value to set up an enumerated
45       value where the possible choice depends on the key of a
46       Config::Model::HashId or the content of a Config::Model::ListId object.
47
48       This class is also used by Config::Model::CheckList to define the
49       cheklist items from the keys of another hash (or content of a list).
50

CONSTRUCTOR

52       Construction is handled by the calling object.
53

Config class parameters

55       refer_to
56           "refer_to" is used to specify a hash element that will be used as a
57           reference. "refer_to" points to an array or hash element in the
58           configuration tree using the path syntax (See "grab" in
59           Config::Model::Node for details).
60
61       computed_refer_to
62           When "computed_refer_to" is used, the path is computed using values
63           from several elements in the configuration tree.
64           "computed_refer_to" is a hash with 2 mandatory elements: "formula"
65           and "variables".
66
67       The available choice of this (computed or not) reference value is made
68       from the available keys of the refered_to hash element or the values of
69       the refered_to array element.
70
71       The example means the the value must correspond to an existing host:
72
73        value_type => 'reference',
74        refer_to => '! host'
75
76       This example means the the value must correspond to an existing lan
77       within the host whose Id is specified by hostname:
78
79        value_type => 'reference',
80        computed_refer_to => { formula => '! host:$a lan',
81                               variables => { a => '- hostname' }
82                             }
83
84       If you need to combine possibilities from several hash, use the ""+""
85       token to separate 2 paths:
86
87        value_type => 'reference',
88        computed_refer_to => { formula => '! host:$a lan + ! host:foobar lan',
89                               variables => { a => '- hostname' }
90                             }
91
92       You can specify "refer_to" or "computed_refer_to" with a "choice"
93       argument so the possible enum value will be the combination of the
94       specified choice and the refered_to values.
95

Methods

97   reference_info
98       Returns a human readable string with explains how is retrieved the
99       reference. This method is mostly used to construct an error messages.
100

AUTHOR

102       Dominique Dumont, (ddumont at cpan dot org)
103

SEE ALSO

105       Config::Model, Config::Model::Value, Config::Model::AnyId,
106       Config::Model::CheckList
107
108
109
110perl v5.12.1                      2010-08-1C8onfig::Model::IdElementReference(3)
Impressum