LibreCat / Catmandu-MODS

Catmandu Importer for importing MODS records, with use of the CPAN module MODS::Record
Other
1 stars 0 forks source link

Installation fails because mods-2.xml and mods-3.xml are invalid #3

Closed pietsch closed 9 years ago

pietsch commented 9 years ago

When trying do cpanm Task::Catmandu on a fresh OpenSUSE 13.2 box, I encountered this error message:

Catmandu-MODS-0.2 $ prove -I lib
t/00_load.t ............. ok
t/01_from_xml.t ......... 1/? shelfLocation not allowed in MODS::Element::Location at /usr/lib/perl5/site_perl/5.20.1/MODS/Record.pm line 2417.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 just after 6.
t/01_from_xml.t ......... Dubious, test returned 255 (wstat 65280, 0xff00)
All 6 subtests passed
t/02_from_json.t ........ ok
t/release-pod-syntax.t .. skipped: these tests are for release candidate testing
Test Summary Report
-------------------
t/01_from_xml.t       (Wstat: 65280 Tests: 6 Failed: 0)
  Non-zero exit status: 255
  Parse errors: No plan found in TAP output
Files=4, Tests=15,  2 wallclock secs ( 0.02 usr  0.02 sys +  1.22 cusr  0.13 csys =  1.39 CPU)
Result: FAIL

It looks like the (Expat?) XML parser used on this platform (OpenSUSE 13.2, x86_64) surprisingly runs in validating mode. On closer inspection, it turns out that two of the three XML files in t/xml/ do not validate against their MODS XML schema. I'm afraid you often find invalid MODS files in the wild that is called library land. So perhaps you want them in your test suite.

I do not know how to switch off validating mode reliably across platforms, but I managed to edit the two offending XML files until they validated. Patch request forthcoming, just in case you want them.

pietsch commented 9 years ago

More surprises: On other platforms (e.g. Debian 7 and 8), this module actually has problems with my repaired XML files! I validated them all right with both Saxon and libxml2 (on all platforms):

$ xmllint --noout --xinclude --schema http://www.loc.gov/standards/mods/v3/mods-3-4.xsd t/xml/mods-2.xml
t/xml/mods-2.xml validates

But on Debian this module complains:

Catmandu-MODS $ prove -I lib
t/00_load.t ....... ok   
t/01_from_xml.t ... 1/? shelfLocator not allowed in MODS::Element::Location at /home/cpietsch/perl5/lib/perl5/MODS/Record.pm line 2432.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 just after 6.
t/01_from_xml.t ... Dubious, test returned 255 (wstat 65280, 0xff00)
All 6 subtests passed 
t/02_from_json.t .. ok   
Test Summary Report
-------------------
t/01_from_xml.t (Wstat: 65280 Tests: 6 Failed: 0)
  Non-zero exit status: 255
  Parse errors: No plan found in TAP output
Files=3, Tests=15,  1 wallclock secs ( 0.02 usr  0.01 sys +  0.86 cusr  0.04 csys =  0.93 CPU)
Result: FAIL

Is this module perhaps confused about which MODS version to validate against?

pietsch commented 9 years ago

Solution found: The platform differences I observed are due to different versions of MODS::Record I had on those systems. If you have the latest version (0.08), this module can cope with my version of the XML files. In fact, it demands these valid XML files.

I will make a new pull request with an updated cpanfile demanding at least version 0.08.