cpan 模块安装失败,没有缺少先决条件
cpan module install failed, no prereqs missing
只是试图安装一个 CPAN 模块,似乎没有缺少任何先决条件,而且似乎找不到任何指向我需要做些什么来解决这个问题的东西。有人可以理解问题可能是什么吗?我宁愿不强制安装,除非我绝对确定它可能只是测试的问题。我查看了之前的问题,问题几乎总是缺少先决条件模块,但这里似乎并非如此。
C:\Users\zacha>cpan XML::Liberal
CPAN: CPAN::SQLite loaded ok (v0.219)
Database was generated on Fri, 04 Mar 2022 11:36:42 GMT
Running install for module 'XML::Liberal'
CPAN: Digest::SHA loaded ok (v6.02)
CPAN: Compress::Zlib loaded ok (v2.1)
Checksum for C:\STRAWB~1\cpan\sources\authors\id\M\MI\MIYAGAWA\XML-Liberal-0.30.tar.gz ok
CPAN: Archive::Tar loaded ok (v2.38)
CPAN: YAML::XS loaded ok (v0.82)
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
CPAN: Module::CoreList loaded ok (v5.20210123)
Configuring M/MI/MIYAGAWA/XML-Liberal-0.30.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for XML::Liberal
Writing MYMETA.yml and MYMETA.json
MIYAGAWA/XML-Liberal-0.30.tar.gz
C:\Strawberry\perl\bin\perl.exe Makefile.PL -- OK
Running make for M/MI/MIYAGAWA/XML-Liberal-0.30.tar.gz
cp lib/XML/Liberal/Remedy/InvalidEncoding.pm blib\lib\XML\Liberal\Remedy\InvalidEncoding.pm
cp lib/XML/Liberal/Error.pm blib\lib\XML\Liberal\Error.pm
cp lib/XML/Liberal/LibXML.pm blib\lib\XML\Liberal\LibXML.pm
cp lib/XML/Liberal/Remedy/NestedCDATA.pm blib\lib\XML\Liberal\Remedy\NestedCDATA.pm
cp lib/XML/Liberal/Remedy/LowAsciiChars.pm blib\lib\XML\Liberal\Remedy\LowAsciiChars.pm
cp lib/XML/Liberal/Remedy/ControlCode.pm blib\lib\XML\Liberal\Remedy\ControlCode.pm
cp lib/XML/Liberal/Remedy/NotUTF8.pm blib\lib\XML\Liberal\Remedy\NotUTF8.pm
cp lib/XML/Liberal/Remedy/UnclosedHTML.pm blib\lib\XML\Liberal\Remedy\UnclosedHTML.pm
cp lib/XML/Liberal.pm blib\lib\XML\Liberal.pm
cp lib/XML/Liberal/Remedy/StandaloneAttribute.pm blib\lib\XML\Liberal\Remedy\StandaloneAttribute.pm
cp lib/XML/Liberal/Remedy/EntityRef.pm blib\lib\XML\Liberal\Remedy\EntityRef.pm
cp lib/XML/Liberal/Remedy/HTMLEntity.pm blib\lib\XML\Liberal\Remedy\HTMLEntity.pm
cp lib/XML/Liberal/Remedy/TrailingElements.pm blib\lib\XML\Liberal\Remedy\TrailingElements.pm
cp lib/XML/Liberal/Remedy/DeprecatedDTD.pm blib\lib\XML\Liberal\Remedy\DeprecatedDTD.pm
cp lib/XML/Liberal/Remedy/TrailingDoctype.pm blib\lib\XML\Liberal\Remedy\TrailingDoctype.pm
cp lib/XML/Liberal/Remedy/Declaration.pm blib\lib\XML\Liberal\Remedy\Declaration.pm
cp lib/XML/Liberal/Remedy/UndeclaredNS.pm blib\lib\XML\Liberal\Remedy\UndeclaredNS.pm
cp lib/XML/Liberal/Remedy/XHTMLEmptyTag.pm blib\lib\XML\Liberal\Remedy\XHTMLEmptyTag.pm
cp lib/XML/Liberal/Remedy/UnquotedAttribute.pm blib\lib\XML\Liberal\Remedy\UnquotedAttribute.pm
MIYAGAWA/XML-Liberal-0.30.tar.gz
C:\STRAWB~1\c\bin\gmake.exe -- OK
Running make test for MIYAGAWA/XML-Liberal-0.30.tar.gz
"C:\Strawberry\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'inc', 'blib\lib', 'blib\arch')" t/*.t
t/00_compile.t ......... Possible precedence issue with control flow operator at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Test/Builder.pm line 917.
t/00_compile.t ......... ok
t/01_bad.t ............. Possible precedence issue with control flow operator at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Test/Builder.pm line 917.
t/01_bad.t ............. 1/?
# Failed test 'C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml'
# at t/01_bad.t line 28.
# got: 'parser error : Specification mandates value for attribute noshade at position 3:14 at t/01_bad.t line 27.
# '
# expected: ''
# Failed test 'created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isa XML::LibXML::Document'
# at t/01_bad.t line 29.
# created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isn't defined
Can't call method "toString" on an undefined value at t/01_bad.t line 33, <$fh> line 1.
# Looks like you failed 2 tests of 15.
# Looks like your test exited with 2 just after 15.
t/01_bad.t ............. Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/15 subtests
t/02_global.t .......... Possible precedence issue with control flow operator at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Test/Builder.pm line 917.
t/02_global.t .......... 7/?
# Failed test 'C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml'
# at t/02_global.t line 19.
# got: 'parser error : Specification mandates value for attribute noshade at position 3:14 at t/02_global.t line 18.
# '
# expected: ''
# Failed test 'created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isa XML::LibXML::Document'
# at t/02_global.t line 20.
# created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isn't defined
# Failed test 'C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml'
# at t/02_global.t line 25.
# got: 'parser error : Specification mandates value for attribute noshade at position 3:14 at t/02_global.t line 24.
# '
# expected: ''
# Failed test 'created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isa XML::LibXML::Document'
# at t/02_global.t line 26.
# created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isn't defined
# Failed test 'C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml'
# at t/02_global.t line 30.
# got: 'parser error : Specification mandates value for attribute noshade at position 3:14 at t/02_global.t line 29.
# '
# expected: ''
# Failed test 'created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isa XML::LibXML::Document'
# at t/02_global.t line 31.
# created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isn't defined
# Looks like you failed 6 tests of 144.
t/02_global.t .......... Dubious, test returned 6 (wstat 1536, 0x600)
Failed 6/144 subtests
t/03_global_destroy.t .. Possible precedence issue with control flow operator at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Test/Builder.pm line 917.
t/03_global_destroy.t .. 1/?
# Failed test 'C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml'
# at t/03_global_destroy.t line 24.
# got: 'parser error : Specification mandates value for attribute noshade at position 3:14 at t/03_global_destroy.t line 23.
# '
# expected: ''
# Failed test 'created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isa XML::LibXML::Document'
# at t/03_global_destroy.t line 25.
# created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isn't defined
t/03_global_destroy.t .. 55/? # Looks like you failed 2 tests of 71.
t/03_global_destroy.t .. Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/71 subtests
t/04_sanity.t .......... Possible precedence issue with control flow operator at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Test/Builder.pm line 917.
Redundant argument in sprintf at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Spiffy.pm line 232.
Redundant argument in sprintf at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Spiffy.pm line 232.
Redundant argument in sprintf at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Spiffy.pm line 232.
Redundant argument in sprintf at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Spiffy.pm line 232.
t/04_sanity.t .......... 1/? parser error : Specification mandates value for attribute nofoo at position 2:12 at t/04_sanity.t line 6.
# Looks like your test exited with 2 just after 12.
t/04_sanity.t .......... Dubious, test returned 2 (wstat 512, 0x200)
All 12 subtests passed
Test Summary Report
-------------------
t/01_bad.t (Wstat: 512 Tests: 15 Failed: 2)
Failed tests: 14-15
Non-zero exit status: 2
t/02_global.t (Wstat: 1536 Tests: 144 Failed: 6)
Failed tests: 19-24
Non-zero exit status: 6
t/03_global_destroy.t (Wstat: 512 Tests: 71 Failed: 2)
Failed tests: 10-11
Non-zero exit status: 2
t/04_sanity.t (Wstat: 512 Tests: 12 Failed: 0)
Non-zero exit status: 2
Files=5, Tests=243, 2 wallclock secs ( 0.11 usr + 0.06 sys = 0.17 CPU)
Result: FAIL
Failed 4/5 test programs. 10/243 subtests failed.
gmake: *** [Makefile:800: test_dynamic] Error 2
MIYAGAWA/XML-Liberal-0.30.tar.gz
C:\STRAWB~1\c\bin\gmake.exe test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports MIYAGAWA/XML-Liberal-0.30.tar.gz
Stopping: 'install' failed for 'XML::Liberal'.
XML-Liberal-0.30 中有两个错误。
不推荐强制安装模块。
这将安装发行版:
wget https://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/XML-Liberal-0.30.tar.gz
tar xvzf XML-Liberal-0.30.tar.gz
cd XML-Liberal-0.30
perl -pe's/mandate/mandates?/' -i~ lib/XML/Liberal/Remedy/StandaloneAttribute.pm
perl -pe's/->extract_error\(\K$\@/"$\@"/' -i~ lib/XML/Liberal.pm
perl -I . Makefile.PL
make test
make install
模块的逻辑基本如下:
- 默认最多15次:
- 尝试使用 XML::LibXML 解析文档,同时捕获错误。
- 如果没有发生错误,
- 成功(Return)
- 对于每条错误消息,
- 修复 XML 以尝试解决错误。
- 失败。
目前的问题是 libxml2 更改了它的一些错误消息。它曾经发出
parser error : Specification mandate value for attribute ...
但语法错误已修复。
parser error : Specification mandates value for attribute ...
修复很简单。在lib/XML/Liberal/Remedy/StandaloneAttribute.pm中,替换
my ($attr) = $error->message =~
/^parser error : Specification mandate value for attribute (\w+)/
or return 0;
和
my ($attr) = $error->message =~
/^parser error : Specification mandates? value for attribute (\w+)/
or return 0;
(我假设某些版本的 libxml2 返回 Specification mandate value
。网络搜索似乎证实了这一点。)
第二个问题是它如何解析错误信息。我不确定损坏的代码试图做什么,但可以通过替换
来解决
my $error = $self->extract_error($@, $xml);
和
my $error = $self->extract_error("$@", $xml);
在XML/Liberal.pm.
只是试图安装一个 CPAN 模块,似乎没有缺少任何先决条件,而且似乎找不到任何指向我需要做些什么来解决这个问题的东西。有人可以理解问题可能是什么吗?我宁愿不强制安装,除非我绝对确定它可能只是测试的问题。我查看了之前的问题,问题几乎总是缺少先决条件模块,但这里似乎并非如此。
C:\Users\zacha>cpan XML::Liberal
CPAN: CPAN::SQLite loaded ok (v0.219)
Database was generated on Fri, 04 Mar 2022 11:36:42 GMT
Running install for module 'XML::Liberal'
CPAN: Digest::SHA loaded ok (v6.02)
CPAN: Compress::Zlib loaded ok (v2.1)
Checksum for C:\STRAWB~1\cpan\sources\authors\id\M\MI\MIYAGAWA\XML-Liberal-0.30.tar.gz ok
CPAN: Archive::Tar loaded ok (v2.38)
CPAN: YAML::XS loaded ok (v0.82)
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
CPAN: Module::CoreList loaded ok (v5.20210123)
Configuring M/MI/MIYAGAWA/XML-Liberal-0.30.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for XML::Liberal
Writing MYMETA.yml and MYMETA.json
MIYAGAWA/XML-Liberal-0.30.tar.gz
C:\Strawberry\perl\bin\perl.exe Makefile.PL -- OK
Running make for M/MI/MIYAGAWA/XML-Liberal-0.30.tar.gz
cp lib/XML/Liberal/Remedy/InvalidEncoding.pm blib\lib\XML\Liberal\Remedy\InvalidEncoding.pm
cp lib/XML/Liberal/Error.pm blib\lib\XML\Liberal\Error.pm
cp lib/XML/Liberal/LibXML.pm blib\lib\XML\Liberal\LibXML.pm
cp lib/XML/Liberal/Remedy/NestedCDATA.pm blib\lib\XML\Liberal\Remedy\NestedCDATA.pm
cp lib/XML/Liberal/Remedy/LowAsciiChars.pm blib\lib\XML\Liberal\Remedy\LowAsciiChars.pm
cp lib/XML/Liberal/Remedy/ControlCode.pm blib\lib\XML\Liberal\Remedy\ControlCode.pm
cp lib/XML/Liberal/Remedy/NotUTF8.pm blib\lib\XML\Liberal\Remedy\NotUTF8.pm
cp lib/XML/Liberal/Remedy/UnclosedHTML.pm blib\lib\XML\Liberal\Remedy\UnclosedHTML.pm
cp lib/XML/Liberal.pm blib\lib\XML\Liberal.pm
cp lib/XML/Liberal/Remedy/StandaloneAttribute.pm blib\lib\XML\Liberal\Remedy\StandaloneAttribute.pm
cp lib/XML/Liberal/Remedy/EntityRef.pm blib\lib\XML\Liberal\Remedy\EntityRef.pm
cp lib/XML/Liberal/Remedy/HTMLEntity.pm blib\lib\XML\Liberal\Remedy\HTMLEntity.pm
cp lib/XML/Liberal/Remedy/TrailingElements.pm blib\lib\XML\Liberal\Remedy\TrailingElements.pm
cp lib/XML/Liberal/Remedy/DeprecatedDTD.pm blib\lib\XML\Liberal\Remedy\DeprecatedDTD.pm
cp lib/XML/Liberal/Remedy/TrailingDoctype.pm blib\lib\XML\Liberal\Remedy\TrailingDoctype.pm
cp lib/XML/Liberal/Remedy/Declaration.pm blib\lib\XML\Liberal\Remedy\Declaration.pm
cp lib/XML/Liberal/Remedy/UndeclaredNS.pm blib\lib\XML\Liberal\Remedy\UndeclaredNS.pm
cp lib/XML/Liberal/Remedy/XHTMLEmptyTag.pm blib\lib\XML\Liberal\Remedy\XHTMLEmptyTag.pm
cp lib/XML/Liberal/Remedy/UnquotedAttribute.pm blib\lib\XML\Liberal\Remedy\UnquotedAttribute.pm
MIYAGAWA/XML-Liberal-0.30.tar.gz
C:\STRAWB~1\c\bin\gmake.exe -- OK
Running make test for MIYAGAWA/XML-Liberal-0.30.tar.gz
"C:\Strawberry\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'inc', 'blib\lib', 'blib\arch')" t/*.t
t/00_compile.t ......... Possible precedence issue with control flow operator at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Test/Builder.pm line 917.
t/00_compile.t ......... ok
t/01_bad.t ............. Possible precedence issue with control flow operator at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Test/Builder.pm line 917.
t/01_bad.t ............. 1/?
# Failed test 'C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml'
# at t/01_bad.t line 28.
# got: 'parser error : Specification mandates value for attribute noshade at position 3:14 at t/01_bad.t line 27.
# '
# expected: ''
# Failed test 'created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isa XML::LibXML::Document'
# at t/01_bad.t line 29.
# created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isn't defined
Can't call method "toString" on an undefined value at t/01_bad.t line 33, <$fh> line 1.
# Looks like you failed 2 tests of 15.
# Looks like your test exited with 2 just after 15.
t/01_bad.t ............. Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/15 subtests
t/02_global.t .......... Possible precedence issue with control flow operator at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Test/Builder.pm line 917.
t/02_global.t .......... 7/?
# Failed test 'C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml'
# at t/02_global.t line 19.
# got: 'parser error : Specification mandates value for attribute noshade at position 3:14 at t/02_global.t line 18.
# '
# expected: ''
# Failed test 'created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isa XML::LibXML::Document'
# at t/02_global.t line 20.
# created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isn't defined
# Failed test 'C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml'
# at t/02_global.t line 25.
# got: 'parser error : Specification mandates value for attribute noshade at position 3:14 at t/02_global.t line 24.
# '
# expected: ''
# Failed test 'created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isa XML::LibXML::Document'
# at t/02_global.t line 26.
# created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isn't defined
# Failed test 'C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml'
# at t/02_global.t line 30.
# got: 'parser error : Specification mandates value for attribute noshade at position 3:14 at t/02_global.t line 29.
# '
# expected: ''
# Failed test 'created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isa XML::LibXML::Document'
# at t/02_global.t line 31.
# created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isn't defined
# Looks like you failed 6 tests of 144.
t/02_global.t .......... Dubious, test returned 6 (wstat 1536, 0x600)
Failed 6/144 subtests
t/03_global_destroy.t .. Possible precedence issue with control flow operator at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Test/Builder.pm line 917.
t/03_global_destroy.t .. 1/?
# Failed test 'C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml'
# at t/03_global_destroy.t line 24.
# got: 'parser error : Specification mandates value for attribute noshade at position 3:14 at t/03_global_destroy.t line 23.
# '
# expected: ''
# Failed test 'created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isa XML::LibXML::Document'
# at t/03_global_destroy.t line 25.
# created DOM node with C:/STRAWB~1/cpan/build/XML-Liberal-0.30-3/t/bad/BAD-atttibute.xml isn't defined
t/03_global_destroy.t .. 55/? # Looks like you failed 2 tests of 71.
t/03_global_destroy.t .. Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/71 subtests
t/04_sanity.t .......... Possible precedence issue with control flow operator at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Test/Builder.pm line 917.
Redundant argument in sprintf at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Spiffy.pm line 232.
Redundant argument in sprintf at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Spiffy.pm line 232.
Redundant argument in sprintf at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Spiffy.pm line 232.
Redundant argument in sprintf at C:\STRAWB~1\cpan\build\XML-Liberal-0.30-3\inc/Spiffy.pm line 232.
t/04_sanity.t .......... 1/? parser error : Specification mandates value for attribute nofoo at position 2:12 at t/04_sanity.t line 6.
# Looks like your test exited with 2 just after 12.
t/04_sanity.t .......... Dubious, test returned 2 (wstat 512, 0x200)
All 12 subtests passed
Test Summary Report
-------------------
t/01_bad.t (Wstat: 512 Tests: 15 Failed: 2)
Failed tests: 14-15
Non-zero exit status: 2
t/02_global.t (Wstat: 1536 Tests: 144 Failed: 6)
Failed tests: 19-24
Non-zero exit status: 6
t/03_global_destroy.t (Wstat: 512 Tests: 71 Failed: 2)
Failed tests: 10-11
Non-zero exit status: 2
t/04_sanity.t (Wstat: 512 Tests: 12 Failed: 0)
Non-zero exit status: 2
Files=5, Tests=243, 2 wallclock secs ( 0.11 usr + 0.06 sys = 0.17 CPU)
Result: FAIL
Failed 4/5 test programs. 10/243 subtests failed.
gmake: *** [Makefile:800: test_dynamic] Error 2
MIYAGAWA/XML-Liberal-0.30.tar.gz
C:\STRAWB~1\c\bin\gmake.exe test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports MIYAGAWA/XML-Liberal-0.30.tar.gz
Stopping: 'install' failed for 'XML::Liberal'.
XML-Liberal-0.30 中有两个错误。
不推荐强制安装模块。
这将安装发行版:
wget https://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/XML-Liberal-0.30.tar.gz
tar xvzf XML-Liberal-0.30.tar.gz
cd XML-Liberal-0.30
perl -pe's/mandate/mandates?/' -i~ lib/XML/Liberal/Remedy/StandaloneAttribute.pm
perl -pe's/->extract_error\(\K$\@/"$\@"/' -i~ lib/XML/Liberal.pm
perl -I . Makefile.PL
make test
make install
模块的逻辑基本如下:
- 默认最多15次:
- 尝试使用 XML::LibXML 解析文档,同时捕获错误。
- 如果没有发生错误,
- 成功(Return)
- 对于每条错误消息,
- 修复 XML 以尝试解决错误。
- 失败。
目前的问题是 libxml2 更改了它的一些错误消息。它曾经发出
parser error : Specification mandate value for attribute ...
但语法错误已修复。
parser error : Specification mandates value for attribute ...
修复很简单。在lib/XML/Liberal/Remedy/StandaloneAttribute.pm中,替换
my ($attr) = $error->message =~
/^parser error : Specification mandate value for attribute (\w+)/
or return 0;
和
my ($attr) = $error->message =~
/^parser error : Specification mandates? value for attribute (\w+)/
or return 0;
(我假设某些版本的 libxml2 返回 Specification mandate value
。网络搜索似乎证实了这一点。)
第二个问题是它如何解析错误信息。我不确定损坏的代码试图做什么,但可以通过替换
来解决my $error = $self->extract_error($@, $xml);
和
my $error = $self->extract_error("$@", $xml);
在XML/Liberal.pm.