Config...ellVar(3pm)

✨ NAME ✨

Config::Model::Backend::ShellVar β€” bestie, this one reads and writes your config as a "SHELLVAR" data structure. 🫢 And yes, the manual you're reading rn is Config...ellVar(3pm) from the User Contributed Perl Documentation. Iconic.


πŸ’« VERSION πŸ’«

version 2.166


πŸŽ€ SYNOPSIS πŸŽ€

okay so here's the whole vibe, take notes πŸ“

use Config::Model;

my $model = Config::Model->new;
$model->create_config_class (
   name    => "MyClass",
   element => [
       [qw/foo bar/] => {qw/type leaf value_type string/}
   ],

  rw_config  => {
    backend => 'ShellVar',
    config_dir => '/tmp',
    file  => 'foo.conf',
    auto_create => 1,
  }
);

my $inst = $model->instance(root_class_name => 'MyClass' );
my $root = $inst->config_root ;

$root->load('foo=FOO1 bar=BAR1' );

$inst->write_back ;

and then, the way that the file foo.conf now contains this?? literally:

## This file was written by Config::Model
## You may modify the content of this file. Configuration
## modifications will be preserved. Modifications in
## comments may be mangled.
##
foo="FOO1"

bar="BAR1"

ate. no crumbs. πŸ’…


🌸 DESCRIPTION 🌸

So Config::Model uses this module directly to read or write the contents of a configuration tree written with "SHELLVAR" syntax in the "Config::Model" configuration tree. That's the whole job, and it does it gorgeously. ✨

⚠️ little heads-up bestie: undefined values get skipped for list elements. So if a list element holds ('a',undef,'b'), the data structure ends up containing 'a','b' β€” the undef just ghosts you. πŸ‘»

πŸ¦‹ CONSTRUCTOR πŸ¦‹

new

Parameters: ( node => $node_obj, name => 'shellvar' )

Inherited from Config::Model::Backend::Any. The constructor gets called by Config::Model::BackendMgr. It's giving inherited-and-thriving. πŸ’œ

read

Of all the parameters passed to this read call-back, only file_path is used.

When a file is read, read returns 1. periodt.

write

Of all the parameters passed to this write call-back, only file_path is used.

write returns 1. slay. πŸŽ€


πŸ‘‘ AUTHOR πŸ‘‘

Dominique Dumont, (ddumont at cpan dot org)


πŸ”₯ SEE ALSO πŸ”₯

Config::Model, Config::Model::BackendMgr, Config::Model::Backend::Any,


🌈 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 🧚 this was perl v5.42.3, dated 2026-07-23 β€” mwah, tysm for reading, go write some configs, ily πŸ“βœ¨

πŸ“¦ where this page comes from