1Config::Model::DescribeU(s3e)r Contributed Perl DocumentaCtoinofnig::Model::Describe(3)
2
3
4

NAME

6       Config::Model::Describe - Provide a description of a node element
7

VERSION

9       version 2.133
10

SYNOPSIS

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        );
25        $model ->create_config_class (
26           name => "MyClass",
27
28           element => [
29
30               [qw/foo bar/] => {
31                   type       => 'leaf',
32                   value_type => 'string'
33               },
34               hash_of_nodes => {
35                   type       => 'hash',     # hash id
36                   index_type => 'string',
37                   cargo      => {
38                       type              => 'node',
39                       config_class_name => 'Foo'
40                   },
41               },
42           ],
43        ) ;
44
45        my $inst = $model->instance(root_class_name => 'MyClass' );
46
47        my $root = $inst->config_root ;
48
49        # put data
50        my $steps = 'foo=FOO hash_of_nodes:fr foo=bonjour -
51          hash_of_nodes:en foo=hello ';
52        $root->load( steps => $steps );
53
54        print $root->describe ;
55
56        ### prints
57        # name          type       value          comment
58        # foo           string     FOO
59        # bar           string     [undef]
60        # hash_of_nodes node hash  <Foo>          keys: "en" "fr"
61

DESCRIPTION

63       This module is used directly by Config::Model::Node to describe a node
64       element. This module returns a human readable string that shows the
65       content of a configuration node.
66
67       For instance (as shown by "fstab" example:
68
69        name         type         value        comment
70        fs_spec      string       [undef]      mandatory
71        fs_vfstype   enum         [undef]      choice: auto davfs ext2 ext3 swap proc iso9660 vfat ignore, mandatory
72        fs_file      string       [undef]      mandatory
73        fs_freq      boolean      0
74        fs_passno    integer      0
75
76       This module is also used by the "ll" command of Config::Model::TermUI.
77

CONSTRUCTOR

79   new
80       No parameter. The constructor should be used only by
81       Config::Model::Node.
82

Methods

84   describe
85       Return a description string.
86
87       Parameters are:
88
89       node
90           Reference to a Config::Model::Node object. Mandatory
91
92       element
93           Describe only this element from the node. Optional. All elements
94           are described if omitted.
95
96       pattern
97           Describe the element matching the regexp ref. Example:
98
99            describe => ( pattern => qr/^foo/ )
100
101       hide_empty
102           Boolean. Whether to hide empty value (i.e. "undef" or '') or not.
103           Default is false.
104
105       verbose
106           Boolean. Display more information with each element. Default is
107           false.
108

AUTHOR

110       Dominique Dumont, (ddumont at cpan dot org)
111

SEE ALSO

113       Config::Model,Config::Model::Node,Config::Model::ObjTreeScanner
114

AUTHOR

116       Dominique Dumont
117
119       This software is Copyright (c) 2005-2018 by Dominique Dumont.
120
121       This is free software, licensed under:
122
123         The GNU Lesser General Public License, Version 2.1, February 1999
124
125
126
127perl v5.28.1                      2019-02-02        Config::Model::Describe(3)
Impressum