Cpan/m 因方法“set_size”而无法安装 Cache::Cache

Cpan/m 因方法“set_size”而无法安装 Cache::Cache

刚刚开始使用 perl(尝试安装一个 Request Tracker):由于某种原因,我无法安装 Cache::Cache!(或者说测试失败):注意:CentOS 5.8 Final(x86_64,2.6.18-308.13.1.el5)上的 perl 5.8.8,Apache 2.2.23(我在 cpan.org 上没有看到 2.6.18-308 的报告,但 2.6.18-xyz 的一些版本失败(主要是 alpha5 或 xend4 版本失败),但大多数都通过了:

我尝试过使用 cpan、cpanm,也尝试过使用 pm-uninstall 来删除它,但是它说它不存在。

cpanm Cache::Cache
--> Working on Cache::Cache
Fetching http://www.cpan.org/authors/id/J/JS/JSWARTZ/Cache-Cache-1.06.tar.gz ... OK
Configuring Cache-Cache-1.05 ... OK
Building and testing Cache-Cache-1.06 ... FAIL
! Installing Cache::Cache failed. See /root/.cpanm/build.log for details.

所以我:

更多/root/.cpanm/build.log

输出的相关部分是(似乎是):

 Manifying blib/man3/Cache::NullCache.3
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/1_test_cache_interface.t ................. ok
t/2_test_memory_cache.t .................... ok

Error:
Can't call method "set_size" on unblessed reference at /root/.cpanm/work/1354840722.23539/Cache-Cache-1.06/blib/lib/Cache/BaseCache.pm line 240.

Can't call method "set_size" on unblessed reference at /usr/local/lib/perl5/site_perl/5.8.8/Error.pm line 38.
    Error::_throw_Error_Simple('HASH(0x11e14db8)') called at /usr/local/lib/perl5/site_perl/5.8.8/Error.pm line 310
    Error::subs::run_clauses('HASH(0x11e14d48)', 'Can\'t call method "set_size" on unblessed reference at /root...', undef, 'ARRAY(0x11efcbd8)') called at /usr/local/lib/perl5/site_perl/5.8.8/Error.pm line 
430
    Error::subs::try('CODE(0x11e14ba8)', 'HASH(0x11e14d48)') called at /root/.cpanm/work/1354840722.23539/Cache-Cache-1.06/blib/lib/Cache/CacheTester.pm line 59
    Cache::CacheTester::test('Cache::CacheTester=HASH(0x11e14ae8)', 'Cache::FileCache=HASH(0x121d2ea8)') called at t/3_test_file_cache.t line 41


t/3_test_file_cache.t ...................... 
Failed 33/35 subtests 

Error:
Can't call method "set_size" on unblessed reference at /root/.cpanm/work/1354840722.23539/Cache-Cache-1.06/blib/lib/Cache/BaseCache.pm line 240.

Can't call method "set_size" on unblessed reference at /usr/local/lib/perl5/site_perl/5.8.8/Error.pm line 38.
    Error::_throw_Error_Simple('HASH(0x15e77d8)') called at /usr/local/lib/perl5/site_perl/5.8.8/Error.pm line 310
    Error::subs::run_clauses('HASH(0x15e7768)', 'Can\'t call method "set_size" on unblessed reference at /root...', undef, 'ARRAY(0x15a1bd8)') called at /usr/local/lib/perl5/site_perl/5.8.8/Error.pm line 43
0
    Error::subs::try('CODE(0x15e74a8)', 'HASH(0x15e7768)') called at /root/.cpanm/work/1354840722.23539/Cache-Cache-1.06/blib/lib/Cache/CacheTester.pm line 59
    Cache::CacheTester::test('Cache::CacheTester=HASH(0x15e7618)', 'Cache::SharedMemoryCache=HASH(0x15e6af8)') called at t/4_test_shared_memory_cache.t line 41


t/4_test_shared_memory_cache.t ............. 
Failed 33/35 subtests 

然后它就重复一段时间...

这是 /root/.cpanm/work/1354840722.23539/Cache-Cache-1.06/blib/lib/Cache/BaseCache.pm 中的第 240/241 行

  $object->set_size( $self->_get_backend( )->
                 get_size( $self->get_namespace( ), $p_key ) );

抱歉,这看起来像是一个新手问题。我已经从所有这些不同的错误中搜索了这么多不同的字符串组合,似乎以前没有人遇到过这个问题。此外,我读到了关于 Cache::Cache 的内容,它非常可靠,两年左右没有更新过,而且它是最常见的模块之一。

我需要这个模块,因为它是 HTML::Mason 的依赖项,而 HTML::Mason 是 Request Tracker 4.0.8 的依赖项。我几乎安装了所有其他依赖项(我尝试安装 IPC::ShareLite,成功了,但尝试安装“mason”,却无济于事)。当然我可以强制安装某些东西,但作为新手,我真的不太习惯“--force”所有东西,因为我知道这不一定有效,测试也告诉我这一点。

我可以看到我缺少其他模块,其中一些无法安装上面提到的模块,此外 Plack 也无法安装:

PSGI missing dependencies:
    Plack ...MISSING

HTML::Mason ...MISSING
        Can't locate HTML/Mason.pm in @INC

HTML::Mason::PSGIHandler ...MISSING
        Can't locate HTML/Mason/PSGIHandler.pm in @INC

Plack::Handler::Starlet ...MISSING

答案1

您在 CentOS 上安装 CPAN 模块而不是使用 CentOS 存储库 /RPM 安装 perl 模块有什么原因吗?如果没有,那么您可以尝试使用 EPEL 存储库中的 RPM:http://fedoraproject.org/wiki/EPEL

他们在 EPEL 中为 CentOS 5 提供了 1.05 版本:http://mirrors.kernel.org/fedora-epel/5/x86_64/perl-Cache-Cache-1.05-1.el5.noarch.rpm。您可能会发现,通过在 CentOS 基础或 EPEL 存储库中定位模块,您可以更轻松地满足依赖关系(如果它们没有明确调用版本 1.06)。

我知道这并不能解决模块构建失败的实际问题。但至少可以作为安装 Cache-Cache 的替代方案。如果您最终选择使用 RPM 软件包,那么另一个值得一试的好工具是http://perl.arix.com/cpan2rpm/。我使用 cpan2rpm 为 CentOS 或 EPEL 存储库中不存在的 perl 模块构建 RPM,并且成功使它们与系统安装的 perl 版本顺利兼容。

相关内容