Config...impleUI(3pm)

πŸ’– NAME πŸ’–

Config::Model::SimpleUI β€” Simple interface for Config::Model

(also known as that icon Config...impleUI(3pm) page from the User Contributed Perl Documentation crew 🫢)

✨ VERSION ✨

version 2.166 β€” yes bestie, this is the one you're on πŸ’…

🌸 SYNOPSIS 🌸

okay so here's the whole vibe, copy-paste it and it just works:

use Config::Model;
use Config::Model::SimpleUI ;

# 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::SimpleUI->new(
   root => $root ,
   title => 'My class ui',
   prompt => 'class ui',
);

# engage in user interaction
$ui -> run_loop ;

print $root->dump_tree ;

Once you've saved that synopsis above into my_test.pl, you can literally do:

$ perl my_test.pl
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

At the end, the test script dumps the configuration tree. The modified bar value can be found in there:

foo=FOO
hash_of_nodes:en
  foo=hello
  bar=bonjour -
hash_of_nodes:fr
  foo=bonjour - -

see?? it ate and left no crumbs πŸ”₯


πŸ¦‹ DESCRIPTION πŸ¦‹

This module provides a pure ASCII user interface using STDIN and STDOUT. That's the whole thing bestie, no GUI, no fancy, just you, your keyboard and the terminal. iconic πŸ’…


πŸ‘‘ USER COMMAND SYNTAX πŸ‘‘

these are the commands you type inside the shell, learn them, love them:

  • cd ... β€” Jump into a node or a value element. You can use cd <element>, cd <elt:key>, or cd - to go up one node, or cd ! to teleport yourself back to the configuration root 🧚
  • set elt=value β€” Set a leaf value.
  • set elt:key=value β€” Set a leaf value that lives inside a hash or list element.
  • clear elt β€” Clear a leaf value (it gets set to undef) or remove all the elements of a hash or list.
  • delete elt β€” Delete a leaf value.
  • delete elt:key β€” Delete a list or hash element.
  • display node_name elt:key β€” Display a value.
  • ls [path] [ pattern ] β€” Show the elements of the current node, or of a node pointed to by path. Elements can be filtered with a shell pattern. See inline help for more details.
  • ll [-nz] [-v] [ pattern ... ] β€” Describe the elements of the current node. Can be used with shell patterns or element names. Skip empty elements with the -nz option. Display more information with the -v option.
  • tree [path] β€” Show the configuration tree from the current node, or from a node pointed to by path.
  • info [path] β€” Show debug information on the current node, or on the element pointed to by path. That debug info may show model parameters, default values or computed values πŸ‘€
  • help β€” Show available commands. (the "who dis" command, but for CLI)
  • desc[ription] β€” Show the class description of the current node.
  • desc(elt) β€” Show the description of an element from the current node.
  • desc(value) β€” Show the effect of a value (for enums).
  • changes β€” Show unsaved changes. bestie please check these before you dip 😭
  • check β€” Without a parameter, show warnings starting from the current node. With an element name as a parameter, do the same thing on that element.
  • fix β€” Try to fix a warning starting from the current node. With an element name as a parameter, do the same on that element. With "!" as the parameter, try to fix warnings starting from the root node by calling apply_fixes there.
  • exit β€” Exit shell. (the farewell, the goodbye, the log off πŸ’”)

πŸŽ€ 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 the user enters '^D' (CTRL-D). That's your whole main character era right there ✨


πŸ’œ 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 the whole page bestie, no cap πŸ’… this was perl v5.42.3, dated 2026-07-23, and it's the Config...impleUI(3pm) manual in all its glory. go forth and cd somewhere cute πŸ¦‹βœ¨

πŸ“¦ where this page comes from