MARC::Lint - Perl extension for checking validity of MARC records
use MARC::File::USMARC; use MARC::Lint; my $lint = new MARC::Lint; my $filename = shift; my $file = MARC::File::USMARC->in( $filename ); while ( my $marc = $file->next() ) { $lint->check_record( $marc ); # Print the title tag print $marc->title, "\n"; # Print the errors that were found print join( "\n", $lint->warnings ), "\n"; } # while
Given the following MARC record:
LDR 00000nam 22002538a 4500 100 14 _aWall, Larry. 110 1 _aO'Reilly & Associates. 245 90 _aProgramming Perl / _aBig Book of Perl / _cLarry Wall, Tom Christiansen & Jon Orwant. 250 _a3rd ed. 250 _a3rd ed. 260 _aCambridge, Mass. : _bO'Reilly, _r2000. 590 4 _aPersonally signed by Larry. 856 43 _uhttp://www.perl.com/
the following errors are generated:
1XX: Only one 1XX tag is allowed, but I found 2 of them. 100: Indicator 2 must be blank 245: Indicator 1 must be 0 or 1 245: Subfield _a is not repeatable. 250: Field is not repeatable. 260: Subfield _r is not valid. 856: Indicator 2 must be blank, 0, 1, 2 or 8
Module for checking validity of MARC records. 99% of the users will want to do something like is shown in the synopsis. The other intrepid 1% will overload the MARC::Lint module's methods and provide their own special field-level checking.
MARC::Lint
What this means is that if you have certain requirements, such as making sure that all 952 tags have a certain call number in them, you can write a function that checks for that, and still get all the benefits of the MARC::Lint framework.
None. Everything is done through objects.
No parms needed. The MARC::Lint object is little more than a list of warnings and a bunch of rules.
Returns a list of warnings found by check_record() and its brethren.
check_record()
Clear the list of warnings for this linter object. It's automatically called when you call check_record().
Create a warning message, built from strings passed, like a print statement.
print
Typically, you'll leave this to check_record(), but industrious programmers may want to do their own checking as well.
Does all sorts of lint-like checks on the MARC record $marc, both on the record as a whole, and on the individual fields & subfields.
Various functions to check the different fields. If the function doesn't exist, then it doesn't get checked.
Makes sure that the 245 has an _a subfield.
Check the docs for MARC::Record. All software links are there.
ISBN and ISSN checking
We can check the 020 and 022 fields with the Business::ISBN and Business::ISSN modules, respectively.
Business::ISBN
Business::ISSN
This code may be distributed under the same terms as Perl itself.
Please note that these modules are not products of or supported by the employers of the various contributors to the code.
Andy Lester, <andy@petdance.com>
<andy@petdance.com>
To install MARC::Lint, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MARC::Lint
CPAN shell
perl -MCPAN -e shell install MARC::Lint
For more information on module installation, please visit the detailed CPAN module installation guide.