cpan 模块安装失败,没有缺少先决条件

发布于 2025-01-11 15:16:16 字数 8641 浏览 0 评论 0原文

只是尝试安装 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'.

Just trying to install a CPAN module, don't seem to be missing any prereqs, and can't seem to find anything that points to what I need to do to fix this. Can someone make sense of what the issue might be? I'd rather not force install unless I'm absolutely sure its maybe just an issue with the tests. I've looked at previous questions and the issue is almost always a missing prereq module but doesn't seem to be the case here.

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'.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梅倚清风 2025-01-18 15:16:16

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

该模块的逻辑基本上如下:

  1. 默认情况下最多 15 次:
    1. 尝试使用 XML::LibXML 解析文档,同时捕获错误。
    2. 如果没有发生错误,
      1. 成功(返回)
    3. 对于每条错误消息,
      1. 对 XML 进行修复以尝试解决错误。
  2. 失败。

目前的问题是 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 返回了规范授权值。网络搜索似乎证实了这一点。)


第二个问题是在于它如何解析错误消息。我不太确定损坏的代码想要做什么,但可以通过在 XML/Liberal.pm 中替换为 来解决

my $error = $self->extract_error($@, \$xml);

my $error = $self->extract_error("$@", \$xml);

There are two bugs in XML-Liberal-0.30.

Forcing the installation of the module is not recommended.

The following will fix the problems and install the distribution:

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

The module's logic is basically the following:

  1. For up to 15 times by default:
    1. Try to parse the document using XML::LibXML while catching errors.
    2. If no errors occurred,
      1. Success (Return)
    3. For each error message,
      1. Apply a fix to the XML to attempt to resolve the error.
  2. Failure.

The issue at hand is that libxml2 has changed some of its error message. It used to emit

parser error : Specification mandate value for attribute ...

But the grammar mistake was fixed.

parser error : Specification mandates value for attribute ...

The fix is simple. In lib/XML/Liberal/Remedy/StandaloneAttribute.pm, replace

    my ($attr) = $error->message =~
        /^parser error : Specification mandate value for attribute (\w+)/
            or return 0;

with

    my ($attr) = $error->message =~
        /^parser error : Specification mandates? value for attribute (\w+)/
            or return 0;

(I'm assuming that some versions of libxml2 returned Specification mandate value. A web search seems to confirm this.)


The second issue is in how it parses error messages. I'm not exactly sure what the broken code is trying to do, but it can be worked around by replacing

my $error = $self->extract_error($@, \$xml);

with

my $error = $self->extract_error("$@", \$xml);

in XML/Liberal.pm.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文