我4天前更新到Mountain Lion,然后意识到我的perl脚本不再起作用。所以我安装了ActivePerl 5.14(最新版本),因为我认为perl已被删除。安装ActivePerl之后,尽管我的程序仍然无法运行:
Warning message:
running command 'perl calc.pl' had status 2
Can't locate Excel/Writer/XLSX.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.4 /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 test.pl line 3.
BEGIN failed--compilation aborted at calc.pl line 3.
在终端中,当我键入perl -v时,表明它使用了新安装的ActivePerl。我使用sudo氏族->安装Excel :: Writer :: XLSX来安装缺少的模块。但是,它不是为ActivePerl 5.14而是为5.12安装的。
自己的Mac OS X Perl接缝将在这里安装:
bash-3.2$ ls /Library/Perl/
5.10 5.12 Updates
bash-3.2$ ls /System/Library/Perl/
5.10 5.12 Extras lib
bash-3.2$
这里还有一个版本:
bash-3.2$ ls /opt/local/lib/perl5/
5.12.4 site_perl vendor_perl
我认为最好是通过运行ActivePerl卸载程序来删除它。我这样做了,并且还删除了5.12.4以及/ opt / local / lib / perl5中的site_perl目录。
然后,我想使用cpan重新安装XLSX :: Writer模块。我以为是然后将其安装到旧的perl目录中。但是,运行cpan现在会导致以下错误:
bash-3.2$ sudo cpan
Can't locate strict.pm in @INC (@INC contains:
/opt/local/lib/perl5/site_perl/5.12.4/darwin-multi-2level
/opt/local/lib/perl5/site_perl/5.12.4
/opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-2level
/opt/local/lib/perl5/vendor_perl/5.12.4 /opt/local/lib/perl5/5.12.4/darwin-multi-
2level /opt/local/lib/perl5/5.12.4 /opt/local/lib/perl5/site_perl
/opt/local/lib/perl5/vendor_perl/5.12.3/darwin-multi-2level
/opt/local/lib/perl5/vendor_perl/5.12.3 /opt/local/lib/perl5/vendor_perl .) at
/opt/local/bin/cpan line 5.
BEGIN failed--compilation aborted at /opt/local/bin/cpan line 5.
我现在不知道该怎么办。我认为我能做的最好的就是大概重新安装Mac OS X自己的Perl,该怎么做?