BibTeX::Parser - A pure perl BibTeX parser
version 0.3.2
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; } }
Creates new parser object.
Parameters:
* fh: A filehandle
Returns the next parsed entry or undef.
To install BibTeX::Parser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm BibTeX::Parser
CPAN shell
perl -MCPAN -e shell install BibTeX::Parser
For more information on module installation, please visit the detailed CPAN module installation guide.