1Config::Model::TreeSearUcsheerr(C3o)ntributed Perl DocumCeonntfaitgi:o:nModel::TreeSearcher(3)
2
3
4

NAME

6       Config::Model::TreeSearcher - Search tree for match in value,
7       description...
8

VERSION

10       version 2.136
11

SYNOPSIS

13        use Config::Model ;
14
15        # define configuration tree object
16        my $model = Config::Model->new ;
17        $model ->create_config_class (
18           name => "MyClass",
19           element => [
20               [qw/foo bar/] => {
21                   type => 'leaf',
22                   value_type => 'string'
23               },
24               baz => {
25                   type => 'hash',
26                   index_type => 'string' ,
27                   cargo => {
28                       type => 'leaf',
29                       value_type => 'string',
30                   },
31               },
32
33           ],
34        ) ;
35
36        my $inst = $model->instance(root_class_name => 'MyClass' );
37
38        my $root = $inst->config_root ;
39
40        my $steps = 'baz:fr=bonjour baz:hr="dobar dan" foo="journalled"';
41        $root->load( steps => $steps ) ;
42
43        my @result = $root->tree_searcher(type => 'value')->search('jour');
44        print join("\n",@result),"\n" ;
45        # print
46        #  baz:fr
47        #  foo
48

DESCRIPTION

50       This class provides a way to search the content of a configuration
51       tree.  Given a keyword or a pattern, the search method scans the tree
52       to find a value, a description or anything that match the given pattern
53       (or keyword).
54

Constructor

56   new (type => [ value | description ... ] )
57       Creates a new searcher object. The "type" parameter can be:
58
59       element
60       value
61       key
62       summary
63       description
64       help
65       all Search in all the items above
66

Methods

68   search
69       Parameters: "(keyword)"
70
71       Search the keyword or pattern in the tree. The search is done in a case
72       insensitive manner. Returns a list of path pointing to the matching
73       tree elements. See "grab" in Config::Model::Role::Grab for details on
74       the path syntax.
75

BUGS

77       Creating a class with just one search method may be overkill. OTOH, it
78       may be extended later to provide iterative search.
79

AUTHOR

81       Dominique Dumont, (ddumont at cpan dot org)
82

SEE ALSO

84       Config::Model, Config::Model::SearchElement, Config::Model::AnyThing
85

AUTHOR

87       Dominique Dumont
88
90       This software is Copyright (c) 2005-2019 by Dominique Dumont.
91
92       This is free software, licensed under:
93
94         The GNU Lesser General Public License, Version 2.1, February 1999
95
96
97
98perl v5.30.0                      2019-08-04    Config::Model::TreeSearcher(3)
Impressum