无法在@INC中找到MIME / Types.pm ...在/usr/local/share/perl/5.10.1/Dancer/MIME.pm第7行

时间:2011-03-10 01:17:33

标签: perl twitter perl-module twitter-oauth dancer

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

我按照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。

问题:这意味着什么,我应该怎么做?

3 个答案:

答案 0 :(得分:4)

您的系统上没有安装MIME :: Types模块,或者它不在您的路径中。如果是前者,那么安装它(你可以用cpan来做)。如果它存在但不在正常位置(读取:“@INC contains:”错误中列出的目录之一),则可以通过添加

来添加该目录
use lib '/path/to/library';

use MIME::Types;声明之前。

答案 1 :(得分:1)

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

答案 2 :(得分:1)

thegeekStuff link完美地解释了安装perl模块的过程。请仔细阅读链接。

安装单独的perl模块:

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

  2. 提取,然后make

  3. $ 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安装任何模块。它还将负责安装所有相关模块。