新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > Linux操作系統(tǒng)下安裝Perl及其模塊的方法

Linux操作系統(tǒng)下安裝Perl及其模塊的方法

作者: 時(shí)間:2016-09-12 來源:網(wǎng)絡(luò) 收藏

Linux和perl都屬于自由軟件,將二者結(jié)合真是妙不可言。遵循以下步驟一般就可安裝好perl,perl 就能在linux下歡唱。

本文引用地址:http://www.2s4d.com/article/201609/305142.htm

1、取得最新版本的 perl,當(dāng)前版本為 5.6.0,即 stable.tar.gz。

2、解文件包:

gunzip stable.tar.gz

tar xvf stable.tar

得到目錄 perl-5.6.0

3、在目錄 perl-5.6.0 下安裝 perl:

rm -f config.sh Policy.sh

sh Configure -de

make

make test

make install

config.sh Policy.sh 為以前安裝時(shí)的配置文件,新安裝或升級(jí)安裝時(shí)需要將其刪除。

sh Configure -de 安裝使用默認(rèn)配置,一般而言將會(huì) ok 。

安裝完成后 perl 所在目錄為 /usr/local/lib/perl5, perl 執(zhí)行文件在 /usr/local/bin 中。

4、關(guān)于 .html 文件

安裝 perl 時(shí)不能自動(dòng)安裝 .html 文件, 在 perl-5.6.0 目錄中有一個(gè)installhtml 文件, 執(zhí)行 perl installhtml --help可得到使用幫助,使用installhtml可將 .pod 及 .pm 文件編譯得到相應(yīng)的 .html 文件文件, 它的具體使用請(qǐng)自己看。

下面是我所寫的一個(gè)具有類似功能的程序。

simple_find(5.6.0);# 含 .pm 文件的源目錄

use Pod::Html;

sub simple_find{

$sourth=/usr/local/lib/perl5/5.6.0html/; #含 .html的目標(biāo)目錄

my ($input)=@_;

my $file;

$ddir=$sourth.$input;

$cont=`file $ddir`;

if ($cont !~/$ddir:sdirectory/){

`mkdir $ddir`;

}

opendir(md,$input);

my @file=readdir(md);

closedir(md);

@pfile= grep(m/.pm/,@file);

my @dfile= grep(!m/.pm/,@file);

@dfile=grep(!m/^./,@dfile);

foreach $pfile(@pfile){

$pfile=~/.pm/;

$dfile=$`;

$sfile=$input./.$pfile;

$dfile=$sourth.$input./.$dfile..html;

pod2html(

--infile=$sfile,

--outfile=$dfile);

}

foreach $file(@dfile){

$vale=$input./.$file;

$cont=`file $vale`;

if ($cont=~/$vale:sdirectory/){

simple_find($vale);

}

}

}

使用以上程序得到一個(gè)與源目錄結(jié)構(gòu)一致的目標(biāo)目錄,包含相應(yīng)的. html文件。

注: 使用以上兩種方法都會(huì)產(chǎn)生不能轉(zhuǎn)化某行類錯(cuò)誤,其實(shí)它無關(guān)大局,可以忽略。

5、模塊安裝

gunzip Module.tar.gz

tar xvf Moudle.tar

轉(zhuǎn)到相應(yīng)目錄

perl Makefile.PL

make

make test

make install

安裝完成后模塊在 /usr/local/lib/perl5/site_perl 目錄中, . html文件不能自動(dòng)安裝,需使用前面介紹方法進(jìn)行安裝。



關(guān)鍵詞:

評(píng)論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉