Perl模組的安裝

2021-06-07 01:20:53 字數 1274 閱讀 8362

安裝perl模組過程如下:

1、進入perl模組安裝目錄(推薦使用root賬戶)。

2、perl makefile.pl   #生成 makefile 檔案

3、make install       #安裝perl模組

乙個最簡單的 makefile.pl 檔案如下所示:

use extutils::makemaker;  #必須的

#需要的模組,可省略

require dbi;

require config::inifiles;

require date::calc;

writemakefile(

'name' => 'common', #如果 pm 模組與當前目錄同名,可省略

'version_from' => 'common.pm' #此句可省略

);

如沒沒省略版本,注意要在 common.pm  中定義版本號   our $version = '1.00';然後使用  perl makefile.pl;  make insall  即可安裝成功。驗證perl已安裝的模組,執行以下命令:

perl -e 'use extutils::installed; 

print join "\n", extutils::installed->new()->modules();

print "\n";'

檢查安裝 perl 模組時包含的檔案,這裡以dbd::oracle 模組為例:

perl -e 'use extutils::installed; 

print join "\n", sort(extutils::installed->new()->files('dbd::oracle'));

print "\n";'

檢查 perl 模組對應的 packlist 檔案,,這裡以 dbd::oracle 模組為例:

perl -e 'use extutils::installed; 

print extutils::installed->new()->packlist('dbd::oracle')->packlist_file();

print "\n";'

對於 perl 模組,把 files() 檔案以及 packlist_file() 檔案刪除即為徹底刪除了perl模組,把這些檔案還原,作用與全新安裝該模組完成相同。

perl安裝模組

1.cpan perl mcpan e shell o conf init 可以初始化cpan vi usr lib perl5 5.8.8 cpan config.pm 更改cpan配置主要是映象的配置 163映象 urllist q install net netmask 就自動安裝了 m 正則...

perl 簡單學習,安裝perl模組

檢查是否安裝了某個perl模組 有多種方式 0.perldoc perlinstall 列出所有的模組及版本號 1.perl m模組名 e 1 模組名不加空格 沒有返回值則說明有此模組 2.perl e use dbd oracle print dbd oracle version n window...

Perl模組的手動安裝

在其他論壇看了很多關於perl模組的安裝,其實有時候很容易出現安裝失敗。尤其是在windows上,比如可以使用cpan,ppm等工具方式。在命令列 中輸入cpan,彈出cpan 然後可以輸入install 模組名,比如我要安裝lwp useragent proxyany 輸入install lwp ...