Ed Summers > MARC-Lint-1.4 > MARC::Lint

Download:
MARC-Lint-1.4.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 1.4   Source   Latest Release: MARC-Lint_1.47

NAME ^

MARC::Lint - Perl extension for checking validity of MARC records

SYNOPSIS ^

    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

DESCRIPTION ^

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.

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.

EXPORT ^

None. Everything is done through objects.

METHODS ^

new()

No parms needed. The MARC::Lint object is little more than a list of warnings and a bunch of rules.

warnings()

Returns a list of warnings found by check_record() and its brethren.

clear_warnings()

Clear the list of warnings for this linter object. It's automatically called when you call check_record().

warn( $str [, $str...] )

Create a warning message, built from strings passed, like a print statement.

Typically, you'll leave this to check_record(), but industrious programmers may want to do their own checking as well.

check_record( $marc )

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.

check_xxx( $field )

Various functions to check the different fields. If the function doesn't exist, then it doesn't get checked.

check_245( $field )

Makes sure that the 245 has an _a subfield.

SEE ALSO ^

Check the docs for MARC::Record. All software links are there.

TODO ^

LICENSE ^

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.

AUTHOR ^

Andy Lester, <andy@petdance.com>

syntax highlighting: