linux - CPAN 安装模块显示正常,但该模块编译失败

标签 linux perl cpan

我正在尝试将 MIME::Parser::FileUnder 子类化,如 here 所述.所以我安装了这个模块:

$ sudo cpan install MIME::Parser::FileUnder
[...]
Result: PASS
  DSKOLL/MIME-tools-5.504.tar.gz
  /usr/bin/make test -- OK
Running make install
Manifying blib/man3/MIME::Decoder::Gzip64.3pm
Appending installation info to /usr/local/lib/perl/5.14.2/perllocal.pod
  DSKOLL/MIME-tools-5.504.tar.gz
  sudo /usr/bin/make install  -- OK

看起来安装正确,但是

$ ./test_gmail.pl
Can't locate MIME/Parser/FileUnder.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at GMailMIMEParser.pm line 4.
BEGIN failed--compilation aborted at GMailMIMEParser.pm line 4.
Compilation failed in require at ./test_gmail.pl line 13.
BEGIN failed--compilation aborted at ./test_gmail.pl line 13.

如果我尝试再次安装 MIME::Parser::FileUnder,它会奇怪地安装它,而不是像其他任何模块一样告诉我它是最新的。

这是我的子类GMailMIMEParser:

package GMailMIMEParser;

use strict;
use MIME::Parser::FileUnder;

our @ISA = qw(MIME::Parser::FileUnder);

my $cur = 0;

sub output_path
{
    my $class = shift;
    my $head = shift;
    print(STDERR $head);
    $cur++;
    return "./$cur";
}

提前致谢!

最佳答案

我只是做错了事。我必须继承 MIME::Parser::Filer 而不是 MIME::Parser::FileUnder,它本身就是一个 MIME::Parser::Filer 子类。

package GMailMIMEParser;

use strict;
use MIME::Parser::Filer;

our @ISA = qw(MIME::Parser::Filer);

my $cur = 0;

sub output_path
{
    my $class = shift;
    my $head = shift;
    print(STDERR $head);
    $cur++;
    return "./$cur";
}

关于linux - CPAN 安装模块显示正常,但该模块编译失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15589154/

相关文章:

linux - 如何从 inotify/incron 中排除 PATTERN

c++ - Linux 系统不允许创建套接字,因为 "Too many open files"*即使在重新启动后*

perl - 在 Perl 脚本中使用 File::Find 时忽略整个目录

Perl CPAN 模块对象方法未找到错误

perl - Perl 工具链中 Meta 2 支持的状态如何?

linux - 解压缩到目录并从 shell 脚本在解压缩的文件夹上运行命令

java - 如何从类似于 eclipse 的命令行创建可运行的 jar 文件

perl - 如何使用 WWW::Mechanize 检查单选框?

perl - 解析字节长度为 3,5,6,7 的有符号整数

perl混了,cpan装不上