Catman..._field(3pm)

πŸ“¦
version 1.2025 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ‘‘ NAME πŸ‘‘

bestie. okay so. Catmandu::Fix::set_field β€” it adds or changes the value of a HASH key or an ARRAY index. that's it. that's the whole job. it's giving tiny fix, main character energy. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so like, set_field changes a value that's already there. it does not build out the path for you.

and the way that it's not like add_field?? add_field will happily create the intermediate structures if they're missing. set_field will not. no cap. if the stuff along the way isn't already sitting there, she's not making it appear out of thin air, she's just not that girl. πŸ’€

lowkey important: this is contrary to add_field. that's literally the difference between them. don't come for me when your deep nested key does nothing. πŸ™ˆ

✨ SYNOPSIS ✨

# Change the value of 'foo' to 'bar 123'
set_field(foo, 'bar 123')

# Change a deeply nested key
set_field(my.deep.nested.key, hi)

# If the second argument is omitted the field has a null value
add_field(foo)

okay so quick tour: first one changes the value of 'foo' to 'bar 123' πŸ“. second one changes a deeply nested key, my.deep.nested.key, to hi 🌸. third one β€” if you leave the second argument out, the field has a null value, so no value, just vibes ✨.

(and yes, that third line says add_field(foo). i am reading it to you exactly as written, bestie, i do not make the rules, i just deliver them. 🫢)


🌈 SEE ALSO 🌈

  • Catmandu::Fix β€” go read her, she's the icon holding the whole thing together πŸ‘‘

that's the whole page fr fr. source/version check: this is perl v5.40.1, dated 2026-01-24 β€” so like, she's fresh, she's current, she's serving. πŸ’– go forth and set_field responsibly (and remember the intermediate structures thing, i'm begging 😭). πŸŽ€πŸ§šβ­

πŸ“¦ where this page comes from