1BibTeX::Parser(3) User Contributed Perl Documentation BibTeX::Parser(3)
2
3
4
6 BibTeX::Parser - A pure perl BibTeX parser
7
9 Parses BibTeX files.
10
11 use BibTeX::Parser;
12 use IO::File;
13
14 my $fh = IO::File->new("filename");
15
16 # Create parser object ...
17 my $parser = BibTeX::Parser->new($fh);
18
19 # ... and iterate over entries
20 while (my $entry = $parser->next ) {
21 if ($entry->parse_ok) {
22 my $type = $entry->type;
23 my $title = $entry->field("title");
24
25 my @authors = $entry->author;
26 # or:
27 my @editors = $entry->editor;
28
29 foreach my $author (@authors) {
30 print $author->first . " "
31 . $author->von . " "
32 . $author->last . ", "
33 . $author->jr;
34 }
35 } else {
36 warn "Error parsing file: " . $entry->error;
37 }
38 }
39
41 new
42 Creates new parser object.
43
44 Parameters:
45
46 * fh: A filehandle
47
48 next
49 Returns the next parsed entry or undef.
50
52 The fields "author" and "editor" are canonized, see
53 BibTeX::Parser::Author
54
56 • BibTeX::Parser::Entry
57
58 • BibTeX::Parser::Author
59
61 version 1.02
62
64 Gerhard Gossen <gerhard.gossen@googlemail.com> and Boris Veytsman
65 <boris@varphi.com>
66
68 This software is copyright (c) 2013-2016 by Gerhard Gossen and Boris
69 Veytsman
70
71 This is free software; you can redistribute it and/or modify it under
72 the same terms as the Perl 5 programming language system itself.
73
74
75
76perl v5.34.0 2022-01-20 BibTeX::Parser(3)