Text::...::File(3pm)
πΈ NAME πΈ
okay so bestie π welcome to the Text::...::File(3pm) page from the User Contributed Perl Documentation β¨ this is all about Text::BibTeX::File β literally the interface to whole BibTeX files π
π¦ SYNOPSIS π¦
use Text::BibTeX::File;
$bib = Text::BibTeX::File->new("foo.bib") or die "foo.bib: $!\n";
# or:
$bib = Text::BibTeX::File->new;
$bib->open("foo.bib", {binmode => 'utf-8', normalization => 'NFC'}) || die "foo.bib: $!\n";
$bib->set_structure ($structure_name,
$option1 => $value1, ...);
$at_eof = $bib->eof;
$bib->close;
π DESCRIPTION π
Text::BibTeX::File serves up an object-oriented interface to BibTeX files π
its most obvious job? keeping a filename and filehandle together for use by the Text::BibTeX::Entry module (which is, like, much more interesting π). on top of that, it lets you specify certain options that apply to a whole database (file), instead of having to repeat them for each entry in the file β¨ right now you can specify the database structure and some structure options. these concepts are fully documented in Text::BibTeX::Structure π
π METHODS π
π§ Object creation, file operations
new ([FILENAME], [OPTS])β makes a shiny newText::BibTeX::Fileobject π«Ά if FILENAME is supplied, it gets passed to theopenmethod (along with OPTS). if theopenfails,newfails and returns false; if theopensucceeds (or if FILENAME isn't supplied),newreturns the new object reference β¨open (FILENAME [OPTS])β opens the file specified by FILENAME. OPTS is an hashref that can have these values:MODEβ mode as specified byIO::FilePERMSβ permissions as specified byIO::File. can only be used in conjunction withMODEBINMODEβ by default,Text::BibTeXuses bytes directly. thus, you need to encode strings accordingly with the encoding of the files you are reading. you can also select UTF-8. in this case,Text::BibTeXwill return UTF-8 strings in NFC mode π note that at the moment files withBOMare not supported π valid values are'raw/bytes'or'utf-8'.NORMALIZATIONβ by default,Text::BibTeXoutputs UTF-8 in NFC form. you can change this by passing the name of a different form β¨ valid values are those forms supported by theUnicode::Normalizemodule ('NFD','NFDK'etc.)RESET_MACROSβ by default,Text::BibTeXaccumulates macros. this means that when you open a second file, macros defined by the first are still available π this may result on warnings of macros being redefined. this option can be used to forceText::BibTeXto clean up all macros definitions (except for the month macros) π§Ή
close ()β closes the filehandle associated with the object. if there is no such filehandle (i.e.,openwas never called on the object), does nothing π€·eof ()β returns the end-of-file state of the filehandle associated with the object: a true value means we are at the end of the file π
π Object properties
set_structure (STRUCTURE [, OPTION => VALUE, ...])β sets the database structure for a BibTeX file. at the simplest level, this means that entries from the file are expected to conform to certain field requirements as specified by the structure module β¨ it also gives you full access to the methods of the particular structured entry class for this structure, allowing you to perform operations specific to this kind of database π see"CLASS INTERACTIONS" in Text::BibTeX::Structurefor all the consequences of setting the database structure for aText::BibTeX::Fileobject.structure ()β returns the name of the database structure associated with the object (as set byset_structure) πpreserve_values ([PRESERVE])β sets the "preserve values" flag, to control all future parsing of entries from this file. if PRESERVE isn't supplied, returns the current state of the flag. seeText::BibTeX::Valuefor details on parsing in "value preservation" mode π
π SEE ALSO π
Text::BibTeXText::BibTeX::EntryText::BibTeX::Structure
π AUTHOR π
Greg Ward <gward@python.net> π«Ά
π COPYRIGHT π
Copyright (c) 1997-2000 by Gregory P. Ward. All rights reserved. This file is part of the Text::BibTeX library. This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
mwah π that's the whole page, bestie! it came from perl v5.42.0 on 2025-01-31, and it's the Text::...::File(3pm) page β bye π«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Text-BibTeX 0.910.0-160000.2.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-Text-BibTeX 0.910.0-160000.2.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-Text-BibTeX 0.910.0-160000.2.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-Text-BibTeX 0.910.0-160000.2.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms