我正在尝试使用cpan安装Array::Iterator
和Text::ParseWords
。我在OSX上使用cpan v1.61
和perl v5.18.2
。
当我启动cpan时,在初始配置之后,我输入install "Array::Iterator"
并且它似乎正确安装。但是当我尝试使用use Array::Iterator
运行我的perl脚本时,我得到:
Can't locate Array/Iterator.pm in @INC (you may need to install the Array::Iterator module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at ./parse.pl line 7.
at ./parse.pl line 7.
main::BEGIN() called at ./parse.pl line 7
eval {...} called at ./parse.pl line 7
BEGIN failed--compilation aborted at ./parse.pl line 7.
at ./parse.pl line 7.
第7行是:
use Array::Iterator;
答案 0 :(得分:1)
添加Array :: Iterator pm文件所在的完整PATH 在shebang行可能未加载路径后,在脚本开头使用以下代码
BEGIN {push(@INC,'PATH')}