2013-01-25 94 views
1

我想玩XML::Rabbit,但即使使用最簡單的代碼,我也遇到了問題。我設法把它分成一行。爲什麼Perl說它找不到我的模塊?

在一個簡單的文件,我用

use Class::Load; 

然後:

perl test_optlist.pl 

Can't locate Data/OptList.pm in @INC (you may need to install the Data::OptList module) (@INC contains: [CUT]) at /home/szymon/perl5/lib/perl5/Class/Load.pm line 8. 
BEGIN failed--compilation aborted at /home/szymon/perl5/lib/perl5/Class/Load.pm line 8. 
Compilation failed in require at test_optlist.pl line 2. 
BEGIN failed--compilation aborted at test_optlist.pl line 2. 

所以讓我們來安裝它:

$ cpanm Data::OptList 
Data::OptList is up to date. (0.107) 

Perl版本:

This is perl 5, version 17, subversion 8 (v5.17.8) built for x86_64-linux 

問題在哪裏?

+0

我想象'cpanm'使用與'perl test_optlist.pl'不同的Perl構建。 – ikegami

+1

我猜測你是在使用Perl的開發版本(爲什麼?!),你已經安裝了多個Perl版本。你如何管理Perl模塊安裝的二進制文件(例如'cpanm')?你用'perlbrew'嗎?這會讓你頭疼。 – ikegami

+0

@ikegami - 謝謝,看起來像cpanm將它安裝在/ usr/share/perl5 /中,而我沒有將它安裝在路徑中。我使用perbrew,我只是編譯新的perl,只是爲了玩一下。我不記得我在哪裏cpanm從:( –

回答

2

你肯定會用另一個perlcpanm。不要

perlbrew install-cpanm 

安裝perlbrew的控制下一個版本的cpanm,確保這一新cpanm是一個發現的第一路徑(雖然我懷疑這將是),然後再次嘗試

+0

謝謝,它的作品:) –

相關問題