NAME

Catmandu::Fix::Bind::list - a binder that loops over MARC fields

SYNOPSIS

# Only add the 720 field to the authors when the $e subfield contains a 'promotor'
do marc_each()
    if marc_match("720e","promotor")
        marc_map("720ab",authors.$append)
    end
end

# Delete all the 500 fields
do marc_each()
    if marc_match("500",".*")
        reject()
    end
end

DESCRIPTION

The marc_each binder will iterate over each individual MARC field and execute the fixes only in context over each individual field.

If a MARC record contains:

500  $aTest
500  $aTest2$eskip
500  $aTest3

then the fix

do marc_each()
    marc_map("500",note.$append)
end

will have the same effect as

marc_map("500",note.$append)

because marc_map by default loops over all repeated MARC fields. But the marc_each bind has the advantage to process fields in context. E.g. to only map fields where the $e doesn't contain 'skip' you can write:

do marc_each()
    unless marc_match("500e",skip)
        marc_map("500",note.$append)
    end
end

SEE ALSO

Catmandu::Fix::Bind