Module installed with cpan isn't showing up

有些话、适合烂在心里 提交于 2019-12-12 04:38:12

问题


I'm trying to install Array::Iterator and Text::ParseWords using cpan. I'm on OSX with cpan v1.61 and perl v5.18.2.

When I start up cpan, after the initial configuration, I type install "Array::Iterator" and it seems to install correctly. But when I try to run my perl script with use Array::Iterator, I get:

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.

Line 7 is:

use Array::Iterator;

回答1:


Add the complete PATH where your Array::Iterator pm file is located Use the below code in start of the script after shebang line may be the path is not loaded

BEGIN { push( @INC, 'PATH' ) }



来源:https://stackoverflow.com/questions/31039341/module-installed-with-cpan-isnt-showing-up

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!