Catman...d::each(3pm)
π Catmandu::Fix::Bind::each(3pm) β bestie edition π
okay so listen. this is Catmandu::Fix::Bind::each, a Perl module, section 3pm of the manual. it's a binder that runs your fixes for every single (key, value) pair in a hash. she's giving very "one at a time, no skipping, we do everyone" energy and honestly? we're obsessed. β¨
πΈ NAME πΈ
Catmandu::Fix::Bind::each β a binder that executes fixes for every (key, value) pair in a hash π
π SYNOPSIS π
so first, imagine we made a hash. a little guy. a vibe:
# Create a hash:
# demo:
# nl: 'Tuin der lusten'
# en: 'The Garden of Earthly Delights'
# Create a list of all the titles, without the language tags.
do each(path: demo, var: t)
copy_field(t.value, titles.$append)
end
# This will result in:
# demo:
# nl: 'Tuin der lusten'
# en: 'The Garden of Earthly Delights'
# titles:
# - 'Tuin der lusten'
# - 'The Garden of Earthly Delights'
# Upcase every key in the root hash
# foo: bar
# test: 1234
do each(path:., var: t)
upcase(t.key)
end
# This will result in
# FOO: bar
# TEST: 1234
see how we justβ¦ collected all the titles with copy_field(t.value, titles.$append)? no language tags, no drama, just titles. and then the second one said "you know what, every key in the root hash is getting UPCASE" and the keys did not argue. periodt. π
β¨ DESCRIPTION β¨
the each binder iterates over a hash and hands you back a (key, value) pair β the inspiration for this bind is literally the Perl each function over at <http://perldoc.perl.org/functions/each.html>, so like, shoutout to the origin story π«Ά β and then it executes all the fixes for each pair. every. single. one. no cap.
the bind always returns a var.key and a var.value pair, and those are the ones you get to use inside your fixes. that's the whole deal bestie, that's the gift. π
π CONFIGURATION π
π¦ path
the path to a hash in the data. tell it where the hash lives and it'll go knock on the door. πͺ
π var
the temporary field that gets created in the root of the record, and it holds a key field and a value field β which contain, you guessed it, the key and the value of the iterated data. she's transparent, she's organized, she's an icon. β¨
π AUTHOR π
Pieter De Praetere, "pieter.de.praetere at helptux.be" π
π SEE ALSO π
- Catmandu::Fix::Bind::list
- Catmandu::Fix::Bind
okay that's the whole page bestie, go forth and iterate πβ¨ no thoughts, just (key, value) pairs π¦
perl v5.40.1 πΈ 2026-01-24 β that's the source, the version and the date, mwah, tysm for reading, ily, bye!! π π
π¦ 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