Config...:TermUI(3pm)
π Config::Model::TermUI β the perl manual, but make it cute β¨
okay bestie, sit down, hydrate, because this is Config::Model::TermUI β the 3pm perl manual page β and it's literally the module that gives you an interactive command line interface for cme. it's in the User Contributed Perl Documentation section, and she is serving.
πΈ NAME πΈ
Config::Model::TermUI β Interactive command line interface for cme
β VERSION β
version 2.166
π¦ SYNOPSIS π¦
no thoughts, just vibes, just copy-paste this:
use Config::Model;
use Config::Model::TermUI ;
# define configuration tree object
my $model = Config::Model->new;
$model->create_config_class(
name => "Foo",
element => [
foo => {
type => 'leaf',
value_type => 'string'
},
bar => '*foo',
]
);
$model ->create_config_class (
name => "MyClass",
element => [
foo => {
type => 'leaf',
value_type => 'string'
},
bar => '*foo',
hash_of_nodes => {
type => 'hash', # hash id
index_type => 'string',
cargo => {
type => 'node',
config_class_name => 'Foo'
},
},
],
) ;
my $inst = $model->instance(root_class_name => 'MyClass' );
my $root = $inst->config_root ;
# put data
my $steps = 'foo=FOO hash_of_nodes:fr foo=bonjour -
hash_of_nodes:en foo=hello ';
$root->load( steps => $steps );
my $ui = Config::Model::TermUI->new(
root => $root ,
title => 'My class ui',
prompt => 'class ui',
);
# engage in user interaction
$ui -> run_loop ;
print $root->dump_tree ;
so once you've saved that synopsis into my_test.pl, you can do literally the same interactions as with Config::Model::SimpleUI β except (and this is the moment) you get TAB completion. π
class ui:$ ls
foo bar hash_of_nodes
class ui:$ ll hash_of_nodes
name value type comment
hash_of_nodes <Foo> node hash keys: "en" "fr"
class ui:$ cd hash_of_nodes:en
class ui: hash_of_nodes:en $ ll
name value type comment
foo hello string
bar [undef] string
class ui: hash_of_nodes:en $ set bar=bonjour
class ui: hash_of_nodes:en $ ll
name value type comment
foo hello string
bar bonjour string
class ui: hash_of_nodes:en $ ^D
and at the end, the test script dumps the configuration tree. the modified bar value is right there, living her truth:
foo=FOO
hash_of_nodes:en
foo=hello
bar=bonjour -
hash_of_nodes:fr
foo=bonjour - -
π DESCRIPTION π
this module is a lil helper that builds a pure ASCII user interface on top of Term::ReadLine. so if you want the good interaction, you need to install either Term::ReadLine::Gnu or Term::ReadLine::Perl. periodt.
depending on your installation, either Term::ReadLine::Gnu or Term::ReadLine::Perl gets used. go see Term::ReadLine if you wanna override the default choice.
π§ Dependencies
this module is optional, bestie, and she depends on Term::ReadLine to work. and because the goal is keeping the dependency list of Config::Model smol, Term::ReadLine is only recommended. cme gracefully degrades to Config::Model::SimpleUI when necessary. she's adaptable like that. π
π USER COMMAND SYNTAX π
go read "USER COMMAND SYNTAX" in Config::Model::SimpleUI. iykyk.
β¨ CONSTRUCTOR β¨
π parameters
rootβ Root node of the configuration treetitleβ UI titlepromptβ UI prompt. the prompt will be completed with the location of the current node.
π Methods
π
run_loop
Engage in user interaction until user enters '^D' (CTRL+D).
π BUGS π
- Auto-completion is not complete.
- Auto-completion provides wrong choice when you try to
cdin a hash where the index contains a white space. i.e. the correct command is"cd foo:"a b""instead of"cd foo: "a b""as proposed by auto completion.
ngl, those are real. auto-complete is doing her best but she is not perfect and we still love her. π
πΈ AUTHOR πΈ
Dominique Dumont, (ddumont at cpan dot org)
π SEE ALSO π
Config::Model, Config::Model::Instance, Config::Model::Node,
π AUTHOR π
Dominique Dumont
π COPYRIGHT AND LICENSE π
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
and that's a wrap, bestie π«Ά this was perl v5.42.3, dated 2026-07-23, straight from Config...:TermUI(3pm). go forth and tab-complete responsibly. β¨π
π¦ where this page comes from
- ubuntu stonking: libconfig-model-perl 2.166-1 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms