Catman...ab_each(3pm)
π Catman...ab_each(3pm) β User Contributed Perl Documentation π
okay bestie, sit down, hydrate, and let me tell you about Catmandu::Fix::Bind::mab_each β it's a binder that loops over MAB2 fields, and honestly? it's giving main character energy in the MAB2 fix pipeline. β¨
πΈ NAME πΈ
Catmandu::Fix::Bind::mab_each β a binder that loops over MAB2 fields π¦
β¨ SYNOPSIS β¨
like, imagine you only want to add field 331 to the title when field 412 matches 'Heise'. you'd write:
# Only add field 331 to the title when field 412 matches 'Heise'
do mab_each()
if mab_match("412","Heise")
mab_map("331",title)
end
end
and when you wanna delete all the 700 subject fields, no cap:
# Delete all the 700 subject fields
do mab_each()
if mab_match("700",".*")
reject()
end
end
π DESCRIPTION π
so the mab_each binder will iterate over each individual MAB2 field and execute the fixes only in context over each individual field. one field at a time, one vibe at a time, periodt. π
if a MAB2 record contains:
705 $a775.05$c775
705 $a702.08$c702
then the fix
do mab_each()
mab_map("705a",subject.$append)
end
will have the same effect as
mab_map("705a",subject.$append)
because mab_map by default loops over all repeated MAB2 fields anyway. π but the mab_each bind has the advantage to process fields in context. e.g. to only map fields where the subfield $c doesn't contain '702' you can write:
do mab_each()
unless mab_match("705","702")
mab_map("705",subject.$append)
end
end
the way that context thing literally changes everything β mab_map alone could never, it's just not that girl for conditional per-field work. π
π SEE ALSO π
Catmandu::Fix::Bind
π AUTHOR π
Johann Rolschewski <jorol@cpan.org> π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2013 by Johann Rolschewski.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's the whole page, bestie β signed off on perl v5.36.0, dated 2022-12-04, from the Catman...ab_each(3pm) page itself. slay, go loop over some MAB2 fields responsibly. πβ¨π¦
π¦ where this page comes from
- debian bookworm: libcatmandu-mab2-perl 0.24-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcatmandu-mab2-perl 0.24-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatmandu-mab2-perl 0.24-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libcatmandu-mab2-perl 0.24-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms