The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Catmandu::Fix::Bind::pica_each - a binder that loops over PICA fields

SYNOPSIS

    # 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

DESCRIPTION

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:

    do pica_each()
        unless pica_match("041A8","Miscellaneous")
            pica_map("041A8",subject.$append)
        end
    end

SEE ALSO

Catmandu::Fix::Bind