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("039D$a","E-Paper")
            pica_map("039D$9",editions.$append)
        end
    end

    do pica_each("0...")
        # process only level 0 fields
    end

DESCRIPTION

The pica_each binder will iterate over each individual PICA field and execute the fixes only in context over each individual field. The current field is bound to record.0.

If a PICA record contains:

    041A    $9040073580$8Bodenbiologie
    041A    $9040674886$8Zeitschrift 

then the fix

    do pica_each()
        pica_map("041A$8",subject.$append)
    end

will have the same effect as

    pica_map("041A$8",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("041A$8","Miscellaneous")
            pica_map("041A$8",subject.$append)
        end
    end

SEE ALSO

Catmandu::Fix::Bind