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 new Text::BibTeX::File object 🫢 if FILENAME is supplied, it gets passed to the open method (along with OPTS). if the open fails, new fails and returns false; if the open succeeds (or if FILENAME isn't supplied), new returns 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 by IO::File
    • PERMS β€” permissions as specified by IO::File. can only be used in conjunction with MODE
    • BINMODE β€” by default, Text::BibTeX uses 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::BibTeX will return UTF-8 strings in NFC mode πŸ’– note that at the moment files with BOM are not supported πŸ™ˆ valid values are 'raw/bytes' or 'utf-8'.
    • NORMALIZATION β€” by default, Text::BibTeX outputs UTF-8 in NFC form. you can change this by passing the name of a different form ✨ valid values are those forms supported by the Unicode::Normalize module ('NFD', 'NFDK' etc.)
    • RESET_MACROS β€” by default, Text::BibTeX accumulates 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 force Text::BibTeX to 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., open was 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::Structure for all the consequences of setting the database structure for a Text::BibTeX::File object.
  • structure () β€” returns the name of the database structure associated with the object (as set by set_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. see Text::BibTeX::Value for details on parsing in "value preservation" mode πŸ“š

πŸ‘€ SEE ALSO πŸ‘€

  • Text::BibTeX
  • Text::BibTeX::Entry
  • Text::BibTeX::Structure

πŸ’– AUTHOR πŸ’–

Greg Ward <gward@python.net> 🫢

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