The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Text::BibTeX::Validate - validator for BibTeX format

SYNOPSIS

    use Text::BibTeX;
    use Text::BibTeX::Validate qw( validate_BibTeX );

    my $bibfile = Text::BibTeX::File->new( 'bibliography.bib' );
    while( my $entry = Text::BibTeX::Entry->new( $bibfile ) ) {
        for my $warning (validate_BibTeX( $entry )) {
            print STDERR "$warning\n";
        }
    }

DESCRIPTION

Text::BibTeX::Validate checks the standard fields of BibTeX entries for their compliance with their format. In particular, value of email is checked against RFC 822 mandated email address syntax, value of doi is checked to start with 10. and contain at least one / and so on. Some nonstandard fields as isbn, issn and url are also checked. Failures of checks are returned as instances of Text::BibTeX::Validate::Warning.

METHODS

validate_BibTeX( $what )

Takes plain Perl hash reference containing BibTeX fields and their values, as well as Text::BibTeX::Entry instances and returns an array of validation messages as instances of Text::BibTeX::Validate::Warning.

clean_BibTeX( $what )

Takes the same input as validate_BibTeX and attempts to reconcile trivial issues like dropping the resolver URL part of DOIs (see shorten_DOI method) and converting month numbers into three-letter abbreviations.

shorten_DOI( $doi )

Remove the resolver URL part, as well as doi: prefixes, from DOIs.

AUTHORS

Andrius Merkys, <merkys@cpan.org>