Usage of CPAN in Perl learning notes
This article mainly introduces the usage of CPAN in Perl learning notes. This article describes CPAN, CPAN's directory functions, and CPAN's installation of Perl Module, for more information, see
CPAN (Comprehensive Perl Archive Network: A Comprehensive Perl Archive Network) is a central repository for finding anything about Perl. It contains intelligence collected from the entire Perl community: hundreds of Perl modules and scripts, equivalent to several books, and the entire Perl release. If something is written in Perl and is useful and free, it is likely to be on CPAN. CPAN has mirrors all over the world. You can find the mirror closest to you on the CPAN road sign in http://www.perl.com/CPAN. The path card will remember which mirror you choose and will automatically redirect to that mirror when you visit the http://www.perl.com/CPAN/ later (pay attention to the last slash. In addition, you can also start from the http://www.cpan.org. This site has different interfaces, but the data is the same.
Authors
This directory contains many subdirectories, one for each contributor. For example, if you want to find the CGI Modules that are well written by Lincoln Stein (now part of the standard Perl version), and you happen to know that he has written these modules, then you can go to the authors/cmdn_stein directory to check the information. If you do not know that he has written these modules, you can find them in the modules directory described below.
Doc
This directory stores all Perl documents of different styles, including several different arrangements and formats on the Perl official manual page, such as text, HTML, PostScript, and Perl's own pod formats.
Modules
This directory contains modules written in a mix of Perl, Perl, and C.
Ports * This directory contains the source code. Sometimes there are some pre-compiled and executable Perl migrations, mainly for operating systems that are not directly supported in the standard version, or some very difficult compilers. Scripts * This directory contains a small number of Perl programs from around the world. They can be used as independent programs or examples. Currently, there are not many programs listed here. However, over time, this region will become richer and richer. Perl Power Tools project (Perl universal toolkit, PPT) is also here. The goal of the PPT is to use Perl to recreate all Unix and tools. Most standards have been completed, and some standards are also completed.
Src
In this directory, you can find the source program of the standard Perl release version. In fact, it is two source programs of the standard Perl version. One is marked with stable, and the other is devel ). (The index page of this directory is described in detail .) They are all links to the corresponding version. When we write this, stable.tar.gz is to the perl-5.6.0.tar.gz (the general solution is: if the second digit of the version number is an even number, then it is the official version, if it is an odd number, then it is the development version. The suffix of .tar.gz is sometimes. tgz, indicating that it is a standard Internet format: GNU compressed tar archive, often called "tarball.
Install the Perl Source
The Code is as follows:
$ Wget http://www.cpan.org/src/5.0/perl-5.18.2.tar.gz
$ Tar-xzf perl-5.18.2.tar.gz
$ Perl-5.18.2 cd
$./Configure-des-Dprefix = $ HOME/localperl
$ Make
$ Make test
$ Make install
Install the Perl Module
Method 1: manual Installation
If you install the DBI module and put it in the/home/Bird directory.
The Code is as follows:
$ Cd/home/Bird # assume that this directory is stored.
$ Tar xvzf DBI-1.13.tar.gz # Extract
$ Cd DBI-1.13 # go to the new directory
$ Perl Makefile. PL # generate the Makefile file
$ Make # create a module
$ Make test # test Module
$ Make install # compilation Module
$ Write a test program as follows:
#! /Usr/bin/perl-w
Use strict;
Use DBI;
..
Test whether the module is available. If no error is reported, OK!
This method is suitable when the installation package is ready. This method can be used to install most packages in Linux! In special cases, you need to query the installation instructions.
Method 2: Install cpan
The Code is as follows:
Perl-MCPAN-e shell
Cpan> h # Get Help
Cpan> m # acquisition module
Cpan [1]> I/DBI/# matched search
Cpan> install DBI # installation Module
Cpan> q # exit Installation
This method is suitable: the host is connected to the Internet and is not blocked!