LibreCat / Catmandu-MARC

Catmandu modules for working with MARC data
https://metacpan.org/release/Catmandu-MARC
Other
8 stars 10 forks source link

Catmandu::Importer::MARC cannot import from string reference, or IO::String #23

Closed nicolasfranck closed 8 years ago

nicolasfranck commented 8 years ago

MARC::File only accepts filenames, or valid filehandles. Filehandles are validated using the function "fileno". Obviously

fileno($io_string) == undef

The importer does not catch the error stored in

$MARC::File::ERROR = "Couldn't open IO::String=GLOB(0x3b6cfe0)"

Another method is opening the string as a filehandle yourself:

my $fh;
open($fh,"<",\$xml);
my $importer = Catmandu::Importer::MARC->new(type => 'XML', fh => $fh);

But that leads to encoding issues in MARC::File:

parser error : Input is not proper UTF-8, indicate encoding !

Should this be made an issue for MARC::File?