Subject: | Allow MARC::File::next to filter fields for us |
Consider this canonical metaphor:
while ( my $marc = $file->next() ) {
for my $field ( $marc->field("6XX") ) {
# Do something with the 6XX tags
}
}
This is inefficient in two ways:
1) We're getting back records that might not have 6XX tags, and
2) We're getting back fields in the records that we know we don't care about
Record and field creation in MARC::Record is fairly expensive,
especially if we want to ignore 90% of them.
Let's allow MARC::File::next to act as a filter when reading, as in:
while ( my $marc = $file->next( '6XX' ) {
for my $field ( $marc->fields() ) {
# Do something with the 6XX
}
}