好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

Linux操作系统下安装Perl及Perl模块方法 - linux教程

Linux操作系统下安装Perl及Perl模块方法

Linux 和 perl 都属于自由软件,将二者结合真是妙不可言,遵循以下步骤一般就可安装好 perl,perl 就能在 linux 下欢唱。

1、取得最新版本的 perl,当前版本为 5.6.0,即 stable.tar.gz。

2、解文件包:

gunzip stable.tar.gz

tar xvf stable.tar

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 Configure -de 安装使用默认配置,一般而言将会 ok.

    安装完成后 perl 所在目录为 /usr/local/lib/perl5, perl 执行文件在 /usr/local/bin 中。

    4、关于.html文件

    安装 perl 时不能自动安装 .html 文件, 在 perl-5.6.0 目录中有一个installhtml 文件, 执行 perl installhtml --help 可得到使用帮助,使用

    installhtml可将 .pod 及 .pm 文件编译得到相应的 .html 文件文件,它的具体使用请自己看,下面是我所写的一个具有类似功能的程序。

  • simple_find( "5.6.0" );# 含 .pm 文件的源目录 use Pod::Html; sub simple_find{ $sourth= "/usr/local/lib/perl5/5.6.0html/" ; #含 .html的目标目录 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); } } } 

    使用以上程序得到一个与源目录结构一致的目标目录,包含相应的. html文件。

    注: 使用以上两种方法都会产生不能转化某行类错误,其实它无关大局,可以忽略。

    5、模块安装

    gunzip Module.tar.gz tar xvf Moudle.tar

    转到相应目录

    perl Makefile.PL make make test make install

    安装完成后模块在 /usr/local/lib/perl5/site_perl 目录中, . html

    文件不能自动安装,需使用前面介绍方法进行安装。

    查看更多关于Linux操作系统下安装Perl及Perl模块方法 - linux教程的详细内容...

  •   阅读:111次