Catmandu::Fix::Bind::pica_each - a binder that loops over PICA fields
# Only add field 039D subfield $9 to the editions when the subfield $a contains a 'E-Paper' do pica_each() if pica_match("039Da","E-Paper") pica_map("039D9",editions.$append) end end # Delete all the 041A subject fields do pica_each() if pica_match("041A",".*") reject() end end
The pica_each binder will iterate over each individual PICA field and execute the fixes only in context over each individual field.
If a PICA record contains:
041A $9040073580$8Bodenbiologie 041A $9040674886$8Zeitschrift
then the fix
do pica_each() pica_map("041A8",subject.$append) end
will have the same effect as
pica_map("041A8",subject.$append)
because pica_map by default loops over all repeated PICA fields. But the pica_each bind has the advantage to process fields in context. E.g. to only map fields where the subfield $8 doesn't contain 'Miscellaneous' you can write:
pica_map
pica_each
do pica_each() unless pica_match("041A8","Miscellaneous") pica_map("041A8",subject.$append) end end
Catmandu::Fix::Bind
To install Catmandu::PICA, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu::PICA
CPAN shell
perl -MCPAN -e shell install Catmandu::PICA
For more information on module installation, please visit the detailed CPAN module installation guide.