在安装了perl-5.12.3
的Mac OS X 10.7.5上,我需要使用utf8::all
模块,所以我手动安装了utf8-all0.024(注意其CPAN页面上的v5.10.0
的最低perl版本(make test
失败了,但我仍然安装了它,看看它是否能工作。它不起作用,所以我决定卸载它。我尝试了perl.com上给出的两种方法,第一种方法不起作用因为它需要perl-5.14.2
。第二种方法给出了这样的消息:
! utf-8 is not found in the following directories and can't be uninstalled.
/Library/Perl/5.12/darwin-thread-multi-2level
/Library/Perl/5.12
它也无法卸载它。如何卸载utf8-all-0.024
?
此外,我还有一个小脚本,列出了所有Perl模块。它是:
use ExtUtils::Installed;
my $inst = ExtUtils::Installed->new();
my @modules = $inst->modules();
foreach $module (@modules) {
print $module . "n";
}
这个脚本开始花费大约一分半的CPU时间来列出模块。在我把系统搞砸之前,它马上就产生了结果。如何纠正?
为了完整起见,这里是perl -V
给出的@INC
@INC:
/Library/Perl/5.12/darwin-thread-multi-2level
/Library/Perl/5.12
/Network/Library/Perl/5.12/darwin-thread-multi-2level
/Network/Library/Perl/5.12
/Library/Perl/Updates/5.12.3/darwin-thread-multi-2level
/Library/Perl/Updates/5.12.3
/System/Library/Perl/5.12/darwin-thread-multi-2level
/System/Library/Perl/5.12
/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.12
.
进一步信息:
perl -Mutf8::all -e 'print $INC{"utf8/all.pm"}, "n"'
给出:
Can't locate Import/Into.pm in @INC (@INC contains: /Library
/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network
/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library
/Perl/5.12 /Library/Perl/Updates/5.12.3/darwin-thread-multi-2level
/Library/Perl/Updates/5.12.3 /System/Library/Perl/5.12/darwin-
thread-multi-2level /System/Library/Perl/5.12 /System/Library
/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library
/Perl/Extras/5.12 .) at /Library/Perl/5.12/utf8/all.pm line 140.
BEGIN failed--compilation aborted at /Library/Perl/5.12/utf8/all.pm line 140.
Compilation failed in require.
BEGIN failed--compilation aborted.
您错误地安装了模块,把事情搞得一团糟。特别是,您没有安装依赖项。
理想情况下,您应该使用提供perl
本身的包管理器。但他们并没有提供每个模块。所以你应该使用非包管理器方法:
cpan utf8::all
(我更喜欢使用perlbrew
安装我自己的perl
,然后我可以不用担心地使用cpan
。(
现在,cpan
可能声称utf8::all已经安装。如果是这样的话,这应该会让你明白:
cpan -t utf8::all
cpan -f utf8::all # Only if the previous command says everything is ok!