最近的工作, 在驗證產品對 IPv6 的支援 ,為了安裝 IPv6 Logo 的測試環境, 需要在 FreeBSD 下安裝 Perl 及其 Module . 陸續的轉貼如下 或其它已經張貼的文章 ,方便自己日後查閱使用 ,也將讓善心人士過去所編寫的文件 ,得以持續流傳 .其版權皆屬原註作者所有.

Perl modules may be installed using the CPAN module or from source.

CPAN method

perl -MCPAN -e shell (to get an interactive CPAN shell)
perl -MCPAN -e 'install Time::JulianDay' (if you know the name of the module, you can install it directly without interacting with the CPAN shell)

Within the CPAN shell:
i /expression/ will search for a Perl module containing expression, and
install module will install the module.

Example:
perl -MCPAN -e shell
i /JulianDay/
install Time::JulianDay

Note: if you are behind a firewall, you may wish to use passive FTP with Perl's Net::FTP module. Set the environment variable FTP_PASSIVE 1 (or any non-zero value) to use passive FTP when downloading Perl modules through CPAN.

 

Manual installation

To manually install a Perl module:

1. Download the Perl module from CPAN or other site.
2. Extract the tarball.
3. Run perl Makefile.PL
4. Run make
5. Run make test
6. Run make install

Note: you should use the same compiler to build Perl modules that you used to build Perl. For example, if you are building Perl modules with gcc and are using a version of Perl that was supplied with your distribution (ex. Solaris 8 includes Perl 5.005_03), you may run into errors.

Example: building Perl DBI with gcc on Solaris 8 system with Perl 5.005 (part of the Solaris 8 release).

cc: unrecognized option `-KPIC'
cc: language depend not recognized

The Makefile for Perl modules is created using flags for SUNWspro (the compiler used to build Perl 5.005 for the Solaris 8 release), not gcc. As a workaround, you could build Perl from source using the gcc compiler, or obtain a packaged version of Perl that is built with gcc, such as those at Sunfreeware. This comp.lang.perl.modules post has more information. 

Checking for existence of a Perl module

An easy way to check for the existence of a Perl module on your system (technically, in Perl's @INC array, a list of directories Perl searches when attempting to load modules) is to run perl -e 'use module;'

Example:

perl -e 'use HTML::Parser;'

If nothing is returned, Perl was able to locate the module. Otherwise, you will see Can't locate HTML/Parser.pm in @INC.

原文轉貼自 : http://www.brandonhutchinson.com/installing_perl_modules.html 


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 Frank 的頭像
    Frank

    經驗交流分享與備忘

    Frank 發表在 痞客邦 留言(0) 人氣()