---
name: "BibTeX::Parser"
section: "3pm"
platform: "linux"
package: "libbibtex-parser-perl"
version: "1.05+dfsg-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/BibTeX::Parser"
---

# BibTeX::Parser(3pm)

A pure perl BibTeX parser

## NAME

BibTeX::Parser - A pure perl BibTeX parser

## SYNOPSIS

Parses BibTeX files.

```
    use BibTeX::Parser;
        use IO::File;
    my $fh = IO::File->new("filename");
    # Create parser object ...
    my $parser = BibTeX::Parser->new($fh);

    # ... and iterate over entries
    while (my $entry = $parser->next ) {
            if ($entry->parse_ok) {
                    my $type    = $entry->type;
                    my $title   = $entry->field("title");
                    my @authors = $entry->author;
                    # or:
                    my @editors = $entry->editor;

                    foreach my $author (@authors) {
                            print $author->first . " "
                                . $author->von . " "
                                . $author->last . ", "
                                . $author->jr;
                    }
            } else {
                    warn "Error parsing file: " . $entry->error;
            }
    }
```

## FUNCTIONS

### new

Creates new parser object.

Parameters:

```
        * fh: A filehandle
```

### next

Returns the next parsed entry or undef.

## NOTES

The fields `"author"` and `"editor"` are canonicalized, see BibTeX::Parser::Author.

## SEE ALSO

- •

  BibTeX::Parser::Entry

- •

  BibTeX::Parser::Author

## VERSION

version 1.04

## AUTHOR

Gerhard Gossen \<gerhard.gossen@googlemail.com\> and Boris Veytsman \<boris@varphi.com\> and Karl Berry \<karl@freefriends.org\>

## COPYRIGHT AND LICENSE

This software is copyright (c) 2013-2024 by Gerhard Gossen and Boris Veytsman and Karl Berry.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
