Config::Model::Role::Grab(3pm) | User Contributed Perl Documentation | Config::Model::Role::Grab(3pm) |
Config::Model::Role::Grab - Role to grab data from elsewhere in the tree
version 2.152
$root->grab('foo:2 bar'); $root->grab(steps => 'foo:2 bar'); $root->grab(steps => 'foo:2 bar', type => 'leaf'); $root->grab_value(steps => 'foo:2 bar');
Role used to let a tree item (i.e. node, hash, list or leaf) to grab another item or value from the configuration tree using a path (a bit like an xpath path with a different syntax).
Grab an object from the configuration tree.
Parameters are:
Examples:
$root->grab(steps => 'foo:2 bar', type => 'leaf') $root->grab(steps => 'foo:2 bar', type => ['leaf','check_list'])
The "steps" parameters is made of the following items separated by spaces:
"?xxx:yy" goes up the tree the same way. But no check is done to see if id "yy" key actually exists or not. Only the element "xxx" is considered when going up the tree.
Like "grab", but returns the value of a leaf or check_list object, not just the leaf object.
"grab_value" raises an exception if following the steps ends on anything but a leaf or a check_list.
Like "grab", but returns the annotation of an object.
Returns the root of the configuration tree.
Parameter: a configuration class name
Go up the configuration tree until a node using the configuration class is found. Returns the found node or undef.
Example:
# returns a Config::Model::Node object for a Systemd::Service config class $self->grab('Systemd::Service');
Dominique Dumont
This software is Copyright (c) 2005-2022 by Dominique Dumont.
This is free software, licensed under:
The GNU Lesser General Public License, Version 2.1, February 1999
2022-07-28 | perl v5.34.0 |