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

8e2ybdfx  于 8个月前  发布在  Perl
关注(0)|答案(1)|浏览(90)

只是试图安装一个CPAN模块,似乎没有丢失任何先决条件,似乎找不到任何指向我需要做什么来解决这个问题的东西。有人能理解这个问题可能是什么吗?我宁愿不强制安装,除非我绝对肯定它可能只是一个问题的测试。我看过以前的问题,问题几乎总是一个失踪的prereq模块,但似乎没有这里的情况。

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

xqk2d5yq1#

XML-Liberal-0.30中有两个bug。
不建议强制安装该模块。
下面将修复问题并安装发行版:

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解析文档,同时捕获错误。
1.如果没有发生错误,
1.成功(返回)
1.对于每个错误消息,
1.对XML应用修复程序以尝试解决错误。
1.失败
现在的问题是libxml 2已经改变了它的一些错误消息。

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;

(我假设libxml 2的某些版本返回Specification mandate value。网络搜索似乎证实了这一点。)
第二个问题是它如何解析错误消息。

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

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

XML/Liberal.pm.

相关问题