Perl module Installation

Source: Internet
Author: User
Tags install perl

Transferred from: http://www.mike.org.cn/blog/index.php?load=read&id=643 http://www.cnblogs.com/itech/archive/2009/08/10/ 1542832.html

Perl has added the concept of modules to the fifth edition to provide the ability to object-oriented programming. This is a milestone in the development of the Perl language. Since then, the vast majority of free software enthusiasts have developed a large number of powerful, ingenious Perl modules, greatly extending the functionality of the Perl language. CPAN (Comprehensive perl Archive Network) is the largest distribution center for Perl modules, including almost all of the Perl modules published today.

Installation method

I am here to introduce the installation methods of Perl modules under various platforms. For example, install the Net-server module.

There are two ways to install Perl modules under a Linux/unix: Manual installation and automatic installation.

The first method is to download the module you need from CPAN, manually compile and install it. The second method is to use the CPAN module to automatically complete the download, compilation, installation of the entire process.

A, manual installation of the steps:

Downloaded the Net-server module version 0.97 of the compressed file net-server-0.97.tar.gz from CPAN (http://search.cpan.org/), assuming it was placed under/usr/local/src/.

Cd/usr/local/src

Unzip the file, and a new net-server-0.97 directory is created.

Tar xvzf net-server-0.97.tar.gz

Change to the extracted directory:

CD net-server-0.97

Generate Makefile:

Perl makefile.pl

Build module: Make

Test module (This step is optional):

Make Test
  
If the test results report "All test OK", you can safely install the compiled modules.

Before installing the module, make sure that you have writable permissions to the PERL5 installation directory (usually obtained with the SU command) and execute:

Make install

Now, try the DBI module. If the following command does not give any output, then there is no problem.

$>perl-mnet::server-e1

The above steps are suitable for most Perl modules under Linux/unix. There may be a few modules that have slightly different installation methods, so it's best to look at the README or install in the installation directory first.

Sometimes, if it is build.pl, the following installation steps are required: (Requires module::build module support)

Perl build.pl
./build
./build Test
./build Install

B, using the CPAN module automatic installation method one:

You need to be connected to the Internet before installation, and you need to get root privileges.

PERL-MCPAN-E Shell

When you first run CPAN, you need to do some setup, if your machine is directly connected to the Internet (dial-up, dedicated line, etc), then all the way back to the line, just the last step to choose a CPAN mirror site from you. For example, I choose to be located in the domestic http://www.cnblogs.com/itech/admin/ftp://www.perl87.cn/CPAN/. Otherwise, if your machine is behind a firewall, you will also need to set up an FTP proxy or an HTTP proxy. The following are common CPAN commands.

Get help
Cpan>help

Lists the list of all modules on the CPAN
Cpan>m

Install the module, automatically complete the Net::server module from the download to the installation of the entire process.
Cpan>install Net::server

Exit
Cpan>quit

C, using the CPAN module automatic installation Method two:

Cpan-i Module Name

Example: Cpan-i net::server

Two windows on Perl module installation

A Manual (similar to Linux) [decompression after Perl makefile.pl nmake/dmake Nmake/dmake Install]

NMAKE requires a CD C:\Program Files\Microsoft Visual Studio X\vc\bin and execute Vcvars32.bat, and then execute NMAKE;

Dmake seems to be CPAN environment configuration is good C:\Perl\site\bin under.

B Cpan (requires Cpan configuration prior to installation, Cpan need to install additional modules Dmake and mingw gcc compiler) (similar to Linux)

C If using ActivePerl, you can use PPM to install, using the PPM GUI or ppm commandline,ppm Commandline instance as follows:

A) Add correct repositories.

c:\perl\bin\ppm Repo Add Http://theoryx5.uwinnipeg.ca/ppms/package.lst

c:\perl\bin\ppm Repo Add http://www.roth.net/perl/packages/

b) Add the Packages

C:\PERL\BIN\PPM Install Carp-assert
C:\PERL\BIN\PPM Install Log-log4perl
C:\PERL\BIN\PPM Install Yaml-syck

The three main cpan sites are:

Domestic:

Please refer to the latest update for http://cpan.org/SITES.html

http://www.perl87.cn/CPAN/Web Mirroring
http://www.cnblogs.com/itech/admin/ftp://www.perl87.cn/CPAN/Module Mirroring
  
Abroad: http://www.cpan.org/

Four when installing with CPAN and PPM be aware of the case of the module name

Finish!

Perl module Installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.