无法使用CPAN安装Perl模块(带XAMPP的Windows XP Server)

时间:2012-01-06 04:43:50

标签: windows perl xampp perl-module windows-xp-sp3

我目前有一台带XAMPP的Windows XP Pro SP3服务器。我今天早些时候为XAMPP下载了Perl插件,安装时没有问题。安装完成后,我可以使用浏览器访问服务器上的.pl文件并正确执行。我现在尝试使用CPAN安装一些Perl模块,并且我在此过程中收到一些错误消息,并且模块不会安装。我对Perl不熟悉,如果有任何帮助,我将不胜感激。以下是我尝试安装模块时会发生的情况:

cpan[4]> install Task::Kensho
Running install for module 'Task::Kensho'
Running make for A/AP/APEIRON/Task-Kensho-0.31.tar.gz
CPAN: LWP::UserAgent loaded ok (v5.817)

I would like to connect to one of the following sites to get 'authors/id/A/AP/AP
EIRON/Task-Kensho-0.31.tar.gz':

 http://www.perl.org/CPAN/
 ftp://ftp.perl.org/pub/CPAN/

Is it OK to try to connect to the Internet? [yes] yes
Fetching with LWP:
  http://www.perl.org/CPAN/authors/id/A/AP/APEIRON/Task-Kensho-0.31.tar.gz
CPAN: Digest::SHA loaded ok (v5.45)
Fetching with LWP:
  http://www.perl.org/CPAN/authors/id/A/AP/APEIRON/CHECKSUMS
Checksum for \.cpan\sources\authors\id\A\AP\APEIRON\Task-Kensho-0.31.tar.gz ok
Scanning cache \.cpan\build for sizes
............................................................................DONE

The system cannot find the path specified.
Uncompressed \.cpan\sources\authors\id\A\AP\APEIRON\Task-Kensho-0.31.tar.gz succ
essfully
Using Tar:"C:\Programme\Microsoft Visual Studio .NET 2003\Vc7\bin\tar.EXE" xvf "
Task-Kensho-0.31.tar":
The system cannot find the path specified.
Couldn't untar Task-Kensho-0.31.tar
CPAN: File::Temp loaded ok (v0.18)
Package seems to come without Makefile.PL.
  (The test -f "\.cpan\build\APEIRON-zQFric\Makefile.PL" returned false.)
  Writing one on our own (setting NAME to TaskKensho)
  Had problems unarchiving. Please build manually
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install
Failed during this command:
 APEIRON/Task-Kensho-0.31.tar.gz              : unwrapped NO -- untar failed

这一特定行:

Using Tar:"C:\Programme\Microsoft Visual Studio .NET 2003\Vc7\bin\tar.EXE" xvf "

引用我系统上没有的文件和目录。我不确定这一点的重要性,但我想我会指出它。

非常感谢任何帮助!

更新:@daxim,谢谢你的建议。我安装了Strawberry Perl,并且能够使用cpan install [模块名称]为我尝试运行的脚本安装所有必需的模块。但是,当我使用Web浏览器访问脚本时,它不会编译,我在Apache错误日志中得到这个:

[Sun Jan 08 13:03:15 2012] [error] [client 192.168.1.1] Can't load 'C:/strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll' for module XML::LibXML: load_file:The specified module could not be found at C:/strawberry/perl/lib/DynaLoader.pm line 200.\r
[Sun Jan 08 13:03:15 2012] [error] [client 192.168.1.1]  at C:/strawberry/perl/site/lib/XML/LibXML.pm line 154\r
[Sun Jan 08 13:03:15 2012] [error] [client 192.168.1.1] BEGIN failed--compilation aborted at C:/strawberry/perl/site/lib/XML/LibXML.pm line 154.\r
[Sun Jan 08 13:03:15 2012] [error] [client 192.168.1.1] Compilation failed in require at C:/strawberry/perl/site/lib/XML/LibXML/SAX.pm line 17.\r
[Sun Jan 08 13:03:15 2012] [error] [client 192.168.1.1] BEGIN failed--compilation aborted at C:/strawberry/perl/site/lib/XML/LibXML/SAX.pm line 17.\r
[Sun Jan 08 13:03:15 2012] [error] [client 192.168.1.1] Compilation failed in require at (eval 27) line 1.\r

我确实安装了XML :: LibXML以及其他必需的模块。再次感谢您的帮助!

2 个答案:

答案 0 :(得分:1)

我在工作中挣扎了两天。

问题实际上是tar(以及其他基于Unix的程序)的错误设置的全局路径。如果您在Strawberry Perl之前安装了Git或Cygwin之类的东西会发生这种情况,因为它们中包含Perl并且我认为这会导致这个问题。

诊断

运行cpan -J

检查tar是否设置为错误的路径/usr/bin/tar

如果是......

解决方案

在命令行中:

perl -MCPAN -e shell

o conf init /tar/

从那里输入正确的FULL路径到Git或Cygwin中的tar程序:

C:\\cygwin64\\bin\tar.exe

之后,当它询问您是否要使用外部命令而不是Perl模块中的构建时,请输入no

答案 1 :(得分:0)

我也在努力解决来自Strawberry Perl的错误信息。

  

无法加载' C:/strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll'

我只看到XML :: LibXML的这个错误。对于Strawberry Perl的XML :: LibXML打包的DLL版本可能存在一些问题,但我不确定。

我最终安装了Activestate Perl,并使用Perl附带的PPM工具来安装丢失的软件包,一切都很顺利。您也可以在Windows中尝试PPM GUI:

开始菜单→所有程序→ActivePerl 5.14.2 Build 1402→Perl Package Manager。