Catmandu::Fix::Bind::each - a binder that executes fixes for every (key, value) pair in a hash
# 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
The each binder will iterate over a hash and return a (key, value) pair (see the Perl each function for the inspiration for this bind) and execute all fixes for each pair.
The bind always returns a var.key and var.value pair which can be used in the fixes.
var.key
var.value
The path to a hash in the data.
The temporary field that will be created in the root of the record containing a key and value field containing the key and value of the iterated data.
key
value
Pieter De Praetere, pieter.de.praetere at helptux.be
pieter.de.praetere at helptux.be
Catmandu::Fix::Bind::list Catmandu::Fix::Bind
To install Catmandu, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu
CPAN shell
perl -MCPAN -e shell install Catmandu
For more information on module installation, please visit the detailed CPAN module installation guide.