Config...CdsFile(3pm)
π Config::Model::Backend::CdsFile π
okay bestie, welcome to the Config...CdsFile(3pm) page β this is one of the User Contributed Perl Documentation girlies, and she's here to spill all the tea about reading and writing config as a Cds data structure. sit down, get cozy, we're doing this π
πΈ NAME πΈ
Config::Model::Backend::CdsFile β bestie, this one reads and writes your config as a Cds data structure. iconic behavior, honestly.
β¨ VERSION β¨
version 2.166 π
π¦ SYNOPSIS π¦
here's the vibe, no cap:
use Config::Model ;
use Data::Dumper ;
# define configuration tree object
my $model = Config::Model->new ;
$model ->create_config_class (
name => "MyClass",
element => [
[qw/foo bar/] => {
type => 'leaf',
value_type => 'string'
},
baz => {
type => 'hash',
index_type => 'string' ,
cargo => {
type => 'leaf',
value_type => 'string',
},
},
],
rw_config => {
backend => 'cds_file' ,
config_dir => '/tmp',
file => 'foo.pl',
auto_create => 1,
}
) ;
my $inst = $model->instance(root_class_name => 'MyClass' );
my $root = $inst->config_root ;
my $steps = 'foo=yada bar="bla bla" baz:en=hello
baz:fr=bonjour baz:hr="dobar dan"';
$root->load( steps => $steps ) ;
$inst->write_back ;
and now β plot twist β "/tmp/foo.pl" contains:
{
bar => 'bla bla',
baz => {
en => 'hello',
fr => 'bonjour',
hr => 'dobar dan'
},
foo => 'yada'
}
ate. no crumbs. periodt π
π DESCRIPTION π
so the way that Config::Model uses this module directly to read or write the content of a configuration tree β and that tree is written with Cds syntax, living inside a Config::Model configuration tree. that's the whole job, and she does it gorgeously β¨
Note: (important, bestie, don't skip this π«Ά)
- Undefined values are skipped for list element. like, if a list element contains
('a',undef,'b'), then the data structure contains'a','b'. the undef just β¨ vanishes β¨. - Cds file is not created (and may be deleted) when no data is to be written. so if there's nothing to say, the file simply does not exist. she's mysterious like that π
π backend parameter π
π config_dir π
Mandatory parameter to specify where is the Cds configuration file. you literally have to give her this one, okay? it's required, no skipping π₯
π§ CONSTRUCTOR π§
πΈ new πΈ
Inherited from Config::Model::Backend::Any. The constructor is called by Config::Model::BackendMgr. so yeah, she doesn't roll solo β she gets summoned by the BackendMgr π«
π read π
Of all parameters passed to this read call-back, only file_path is used. literally just file_path, everything else is giving background character energy π
It can also be undef. In which case read returns 0. no file, no vibes, returns 0, bye.
When a file is read, read returns 1. slay π
π¦ write π¦
Of all parameters passed to this write call-back, only file_path is used. again with the lone file_path β she's loyal, ngl.
write returns 1. that's it, that's the whole function. short and iconic π
π AUTHOR π
Dominique Dumont, (ddumont at cpan dot org)
π₯ SEE ALSO π₯
Config::Model, Config::Model::BackendMgr, Config::Model::Backend::Any,
(the comma at the end is canon, iykyk π«Ά)
π AUTHOR π
Dominique Dumont
(yes bestie, AUTHOR appears twice. we don't question the layout decisions, we respect them β¨)
πΈ 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 the whole page, bestie!! this was perl v5.42.3 on 2026-07-23, filed under Config...CdsFile(3pm) β you're gonna do amazing with it, go read some config files and slay π
πβ¨
π¦ 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