Config...Update(3pm)
π Config::Model::Value::Update β bestie edition β¨
okay so real talk, this is a page from the User Contributed Perl Documentation, and the manual name is Config...Update(3pm) (the full vibe is Config::Model::Value::Update, iykyk π
). It's a tiny module with a huge job, and I'm gonna walk you through it like we're texting at 2am. grab a snack π
β¨ VERSION β¨
version 2.166 β that's the version, periodt. π
π SYNOPSIS π
so like, here's how it looks when you're declaring it inside a model. bestie, this is verbatim, don't touch a single character:
# in a model declaration:
element => [
data_from_some_file => {
type => 'leaf',
value_type => 'uniline',
update => {
# handled by this module, Config::Model::Value::Update
when_missing => 'warn',
files => [
{
# handled by Config::Model::Value::UpdateFromFile
type => 'ini',
file => "some_file.ini",
subpath => "foo.bar"
},
{
# ...
}
]
}
},
],
see how the update block is ours (Config::Model::Value::Update) but each individual file entry inside files gets handed off to Config::Model::Value::UpdateFromFile? splitting the work, iconic behavior honestly π
π¦ DESCRIPTION π¦
This class retrieves data from external files. For each file, the caller must specify:
- the file path ποΈ
- the file type (e.g. JSON, Yaml...) π
- the path inside the file to retrieve data π
three things. no more, no less, no cap.
πΈ Constructor πΈ
Constructor parameters are, and I quote (not really, I'm vibing, but the facts stay):
filesβ Configuration data to build an array ofConfig::Model::Value::UpdateFromFileobjects. it's giving "build the whole squad" πwhen_missingβ Behavior when no data is found in any file. Can be"ignore","warn"or"die". choose your fighter βοΈ (yes,dieis literally one of the options, it's dramatic like that π)locationβ location of the calling value element. This is used to log messages. π so when something goes wrong, the logs know where it went wrong. main character energy for error reporting.
π§ methods π§
π get_info
Return all files and subpaths used to extract data. that's it, that's the whole function. she's simple, she's efficient, she slays β¨
π get_update_value
Try to get data from the external files. The files are tried in the same order as the "files" parameter. Data is returned at the first successful try. π
If no data can be found β either if all files are missing or all subpath do not yield data β this function either returns, warns or die, depending on the value of the "when_missing" parameter. so it's basically doing a vibe check on your when_missing setting and reacting accordingly π
lowkey important: this one does NOT come with a chill mode. if you told it die, it WILL die. respect the setting bestie π
π Examples π
a whole example, verbatim, so you can copy-paste and feel something:
update => {
when_missing => 'ignore',
files => [
{
type => 'yaml',
file => 'META.yml',
subpath => 'abstract'
},
{
type => 'json',
file => 'package.json'
subpath => 'description'
}
]
}
here it's trying META.yml first (yaml, pulling out abstract), then falling back to package.json (json, pulling out description). first one that hits wins. obsessed with the fallback energy π«Ά
π SEE ALSO π
Config::Model::ValueConfig::Model::Value::UpdateFromFile
go read these too, they're the supporting cast and honestly they ate π
π AUTHOR π
Dominique Dumont β author extraordinaire, we stan π
π 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 beauty shipped with perl v5.42.3, dated 2026-07-23 (yes I said 2026, that's what it says, don't come for me π). now go forth and pull data from external files like the absolute icon you are πβ¨π¦
π¦ 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