Subject: | Text::BibTeX::Entry->new() cannot read from standard input |
Date: | Thu, 29 Dec 2016 16:36:44 +1300 |
To: | bug-Text-BibTeX [...] rt.cpan.org |
From: | Karl Wette <karl.wette [...] aei.mpg.de> |
Hi,
Text::BibTeX::Entry->new() cannot read from standard input, if one
specifies a filename/handle pair, it instead errors with:
new: source argument must be either a Text::BibTeX::File (or descendant)
object, filename/filehandle pair, or a string
I believe the source of this bug is the following line in Entry.pm:
elsif (@source == 2 && defined $source[0] && ! ref $source[0] && fileno
($source[1]))
Since standard input is typically on file descriptor #0, the test "fileno
($source[1]))", i.e. "fileno ($source[1])) != 0" fails. This should
probably be changed to "fileno ($source[1])) >= 0", or some other test for
file handles.
Thanks for creating/maintaining this module, I have found it very useful!
Cheers,
Karl