Catman..._field(3pm)
β¨ NAME β¨
Catmandu::Fix::add_field β bestie, this is the fix that adds a brand-new value to a HASH key or an ARRAY index, or changes one that's already chilling there. π
π DESCRIPTION π
So like, <rainbow>the whole point</rainbow> β unlike its sibling set_field, this one is the generous icon. If the intermediate structures along the way don't exist yet? It literally just creates them for you. No drama, no missing-key meltdown, it builds the whole path on the way in. π«Ά
Not me showing up to a key that doesn't exist and justβ¦ making it exist. Main character energy fr fr. π
π SYNOPSIS π
# Add a new field 'foo' with value 2
add_field(foo, 2)
# Change the value of 'foo' to 'bar 123'
add_field(foo, 'bar 123')
# Create a deeply nested key
add_field(my.deep.nested.key, hi)
# If the second argument is omitted the field has a null value
add_field(foo)
Obsessed with that last one tbh β skip the second argument and the field just gets a null value. Simple as. β¨
πΈ SEE ALSO πΈ
Catmandu::Fixβ go say hi to the parent, iykyk π
okay that's the whole page, no cap π¦ this was the Catmandu::Fix::add_field manual from the User Contributed Perl Documentation, written against perl v5.40.1 and dated 2026-01-24. mwah, go build some nested keys bestie π
π
π¦ where this page comes from
- ubuntu resolute: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms