我正在尝试使用HTML::WikiConverter::MediaWiki
安装的yum install perl-HTML-WikiConverter-MediaWiki.noarch
。
根据perldoc我应该
use HTML::WikiConverter;
my $wc = new HTML::WikiConverter( dialect => 'MediaWiki' );
然后我得到了
Can't locate HTML/WikiConverter.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at ./test.pl line 3.
BEGIN failed--compilation aborted at ./test.pl line 3.
如果我尝试
use HTML::WikiConverter::MediaWiki;
my $wc = new HTML::WikiConverter( dialect => 'MediaWiki' );
然后我得到
Can't locate object method "new" via package "HTML::WikiConverter" at ./test.pl line 4.
如果我尝试
use HTML::WikiConverter::MediaWiki;
my $wc = new HTML::WikiConverter::MediaWiki( dialect => 'MediaWiki' );
然后我得到
Can't locate object method "new" via package "HTML::WikiConverter::MediaWiki" at ./test.pl line 4.
问题
有人能看出什么问题吗?
更新
[root@rt ~]# cpan HTML::WikiConverter
Reading '/root/.cpan/Metadata'
Database was generated on Fri, 09 Mar 2012 16:12:01 GMT
Running install for module 'HTML::WikiConverter'
Running make for D/DI/DIBERRI/HTML-WikiConverter-0.68.tar.gz
Checksum for /root/.cpan/sources/authors/id/D/DI/DIBERRI/HTML-WikiConverter-0.68.tar.gz ok
CPAN.pm: Building D/DI/DIBERRI/HTML-WikiConverter-0.68.tar.gz
Checking if your kit is complete...
Looks good
Writing Makefile for HTML::WikiConverter
Writing MYMETA.yml and MYMETA.json
cp lib/HTML/WikiConverter.pm blib/lib/HTML/WikiConverter.pm
cp lib/HTML/WikiConverter/Normalizer.pm blib/lib/HTML/WikiConverter/Normalizer.pm
cp lib/HTML/WikiConverter/WebApp.pm blib/lib/HTML/WikiConverter/WebApp.pm
cp lib/HTML/WikiConverter/Dialects.pod blib/lib/HTML/WikiConverter/Dialects.pod
cp bin/html2wiki blib/script/html2wiki
/usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/html2wiki
Manifying blib/man1/html2wiki.1
Manifying blib/man3/HTML::WikiConverter.3pm
Manifying blib/man3/HTML::WikiConverter::Normalizer.3pm
Manifying blib/man3/HTML::WikiConverter::Dialects.3pm
Manifying blib/man3/HTML::WikiConverter::WebApp.3pm
DIBERRI/HTML-WikiConverter-0.68.tar.gz
/usr/bin/make -- OK
'YAML' not installed, will not store persistent state
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-load.t ........... 1/1 # Testing HTML::WikiConverter 0.68, Perl 5.008008, /usr/bin/perl
t/00-load.t ........... ok
t/01-normalizer.t ..... ok
t/01-wikiconverter.t .. 1/53 request for <http://diberri.dyndns.org/wikipedia/html2wiki-old/test.html> failed at t/01-wikiconverter.t line 162
# Looks like you planned 53 tests but ran 35.
# Looks like your test exited with 22 just after 35.
t/01-wikiconverter.t .. Dubious, test returned 22 (wstat 5632, 0x1600)
Failed 18/53 subtests
t/boilerplate.t ....... ok
t/pod-coverage.t ...... ok
t/pod.t ............... ok
Test Summary Report
-------------------
t/01-wikiconverter.t (Wstat: 5632 Tests: 35 Failed: 0)
Non-zero exit status: 22
Parse errors: Bad plan. You planned 53 tests but ran 35.
Files=6, Tests=53, 1 wallclock secs ( 0.06 usr 0.04 sys + 0.60 cusr 0.12 csys = 0.82 CPU)
Result: FAIL
Failed 1/6 test programs. 0/53 subtests failed.
make: *** [test_dynamic] Error 255
DIBERRI/HTML-WikiConverter-0.68.tar.gz
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports DIBERRI/HTML-WikiConverter-0.68.tar.gz
Running make install
make test had returned bad status, won't install without force
[root@rt ~]#
答案 0 :(得分:1)
您没有安装HTML::WikiConverter
。所以,安装它。从命令行,执行
cpan HTML::WikiConverter
并且不仅要安装HTML::WikiConverter
,还应安装任何缺少的先决条件。
此外,根据您的用户权限,您可能需要以root身份运行该命令(即sudo cpan HTML::WikiConverter
)。
答案 1 :(得分:1)
听起来您没有在需要的地方安装基本行为HTML::WikiConverter
。我不知道为什么HTML::WikiConverter::MediaWiki
中的use base
没有失败。 HTML::WikiConverter
是与HTML::WikiConverter::MediaWiki
的单独分发,而HWM使用HW的构造函数,因此如果您无法加载此模块,则Perl无法识别new
的分派。
答案 2 :(得分:0)
当您运行yum install perl-HTML-WikiConverter-MediaWiki.noarch
时,您是否获得了任何提及安装perl-HTML-WikiConverter的输出?
您从运行rpm -q perl-HTML-WikiConverter
和rpm -q perl-HTML-WikiConverter-MediaWiki
获得了哪些输出。
您运行的是哪个版本的Perl(perl -v
),它安装在哪里(which perl
)以及它是如何安装的(使用yum或下载源代码并编译它)?
我怀疑您的系统在安装了yum的CPAN模块和cpan-install CPAN模块之间感到困惑。将两者混合在同一系统上永远不是一个好主意。如果要使用Perl的系统版本,则只使用yum安装CPAN模块。如果要使用cpan(或cpanp或cpanm)安装CPAN模块,请构建自己的Perl版本,并将其安装在远离标准Perl位置的位置。