Config...otation(3pm)

πŸ’– Config::Model::Annotation πŸ’–

okay bestie, welcome to the Config...otation(3pm) page 🌸 β€” yeah that title's giving "my man renderer ran out of room" energy, but it's really Config::Model::Annotation, straight out of the User Contributed Perl Documentation collection. grab a strawberry drink πŸ“ and let's get into it.


✨ NAME ✨

Config::Model::Annotation β€” Read and write configuration annotations 🌈

that's the whole vibe. read 'em, write 'em, slay.


πŸŽ€ VERSION πŸŽ€

version 2.166 ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

here's what it looks like when you actually use it, no cap:

use Config::Model ;

# 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',
           },
       },

   ],
) ;

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

my $root = $inst->config_root ;

# put some data in config tree the hard way
$root->fetch_element('foo')->store('yada') ;
$root->fetch_element('baz')->fetch_with_id('en')->store('hello') ;

# put annotation the hard way
$root->fetch_element('foo')->annotation('english') ;
$root->fetch_element('baz')->fetch_with_id('en')->annotation('also english') ;

# put more data the easy way
my $steps = 'baz:fr=bonjour#french baz:hr="dobar dan"#croatian';
$root->load( steps => $steps ) ;

# dump resulting tree with annotations
print $root->dump_tree;

# save annotations
my $annotate_saver = Config::Model::Annotation
 -> new (
         config_class_name => 'MyClass',
         instance => $inst ,
         root_dir => '/tmp/', # for test
        ) ;
$annotate_saver->save ;

# now check content of /tmp/config-model/MyClass-note.pl
bestie the synopsis comment says -note.pl and the description below says -note.yml πŸ™ˆ I don't make the rules, I just report them. both appear exactly as written, fr fr.

πŸ’œ DESCRIPTION πŸ’œ

so this module hands you an object that reads and writes annotations β€” think of them as comments, but for your config tree πŸ’… β€” back and forth to and from a configuration tree, and then it saves them into a file. not the configuration file, a whole separate file. and the reason it exists? it lets you stash annotations for configuration files that do not support comments at all. iconic workaround energy.

🚨 but listen: this module should not be used for configuration files that do support comments. if your file already does comments, go use those, okay? periodt.

where does your annotation file actually land? it depends on the effective id of the process (EUID, the real one, not your dreams):

  • /var/lib/config-model/<model_name>-note.yml β€” for root (EUID == 0) πŸ‘‘
  • ~/.config-model/<model_name>-note.yml β€” for a normal user (EUID > 0) 🧚

🫢 CONSTRUCTOR 🫢

quite standard, ngl. you pass it a Config::Model::Instance object and it just... takes it. no drama, no surprises. πŸŽ€


πŸ”₯ METHODS πŸ”₯

save

Save annotations in a file (See DESCRIPTION) πŸ’Ύ

load

Loads annotations from a file (See DESCRIPTION) πŸ“‚


πŸ’€ CAVEATS πŸ’€

This module is currently not used. πŸ’€

yeah. that's the whole caveat. it's giving "I'm in the codebase but not in the group chat" energy. 😭


πŸ‘‘ AUTHOR πŸ‘‘

Dominique Dumont, (ddumont at cpan dot org) πŸ‘‘


🌈 SEE ALSO 🌈

go check out the rest of the friend group, they're all iconic:

  • Config::Model
  • Config::Model::Node
  • Config::Model::Loader
  • Config::Model::Searcher
  • Config::Model::Value

πŸ‘‘ AUTHOR πŸ‘‘ (yes, the sequel πŸ’…)

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 page, bestie 🫢 this was perl v5.42.3, dated 2026-07-23, and the manual name is Config...otation(3pm) in case you need to cite your sources. go annotate something and be the main character of your own config tree πŸ’–πŸ‘‘βœ¨

πŸ“¦ where this page comes from