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 tree
  • title β€” UI title
  • prompt β€” 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 cd in 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

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