1

我对编程很陌生,所以如果我错过了一些明显的东西,我深表歉意。

我按照https://github.com/keeth/Net-OAuth/blob/master/README上的说明进行操作,出现以下错误:

Can't locate MIME/Types.pm in @INC
(@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 
/usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10
/usr/local/lib/site_perl .) at /usr/local/share/perl/5.10.1/Dancer/MIME.pm line 7.

听起来 perl 模块中有错误Dancer/MIME.pm?如果是这样,我不知道如何调试它。

附录:更多错误信息。

$ ./mayor-emanuel.pl Can't locate HTTP/Body.pm in @INC (@INC contains: /etc/perl 
/usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 
/usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at 
/usr/local/share/perl/5.10.1/Dancer/Request.pm line 12. BEGIN failed--compilation aborted at 
/usr/local/share/perl/5.10.1/Dancer/Request.pm line 12. Compilation failed in require at 
/usr/local/share/perl/5.10.1/Dancer/Route.pm line 11. BEGIN failed--compilation aborted at 
/usr/local/share/perl/5.10.1/Dancer/Route.pm line 11. Compilation failed in require at
/usr/local/share/perl/5.10.1/Dancer/Route/Registry.pm line 5. BEGIN failed--compilation 
aborted at /usr/local/share/perl/5.10.1/Dancer/Route/Registry.pm line 5. Compilation failed 
in require at /usr/local/.../Dancer/App.pm line 10. BEGIN failed--compilation aborted at 
/usr/local/share/perl/5.10.1/Dancer/App.pm line 10. Compilation failed in require at 
/usr/local/share/.../Dancer.pm line 13. BEGIN failed--compilation aborted at 
/usr/local/share/perl/5.10.1/Dancer.pm line 13. Compilation failed in require at ./mayor-
emanuel.pl line 5. BEGIN failed--compilation aborted at ./mayor-emanuel.pl line

顺便说一句,我使用的是 Ubuntu 10.04。

问题:这是什么意思,我该怎么办?

4

3 回答 3

4

MIME::Types 模块未安装在您的系统上或不在您的路径中。如果是前者,则安装它(您可以使用 cpan 执行此操作)。如果它存在但不在正常位置(阅读:“@INC 包含:”错误中列出的目录之一),您可以通过添加来添加该目录

use lib '/path/to/library';

use MIME::Types;声明之前。

于 2011-03-10T01:50:37.280 回答
1

听起来您需要安装MIME::Types模块。

于 2011-03-10T01:34:28.747 回答
1

ThegeekStuff链接完美地解释了安装 perl 模块的过程。请通过链接。

要安装单个 perl 模块:

  1. 下载 perl 模块,你可以在 CPAN 上找到它。

  2. 提取它然后make

$ gzip -d XML-Parser-2.36.tar.gz  
$ tar xvf XML-Parser-2.36.tar

现在make

$ perl Makefile.PL  
Checking if your kit is complete...  
Looks good  
Writing Makefile for XML::Parser::Expat  
Writing Makefile for XML::Parser  
$ make  
$ make test  
$ make install

通过这种方法,您将安装单个模块,但如果它有任何依赖模块,您将需要手动安装它。或者,安装 perl 模块的最佳方法是cpan

首先cpan 安装一次

 $ yum install perl-CPAN

配置完成后,用于cpan安装任何模块。它还将负责安装所有依赖模块。

于 2012-09-13T11:42:06.030 回答