Introduction to the CPAN use of Perl learning notes _perl

Source: Internet
Author: User
Tags documentation install perl
CPAN (Comprehensive Perl Archive Network) is the central repository for finding anything related to Perl. It contains wisdom gathered from the entire Perl community: hundreds of Perl modules and scripts, documentation equivalent to several books, and the entire Perl distribution. If something is written in Perl and it is useful and free, then it is most likely on CPAN. CPAN has mirrors all over the world. You can find the mirror closest to you on the CPAN street sign at http://www.perl.com/CPAN. That sign will remember which image you chose and you will be redirected to that image automatically when you visit http://www.perl.com/CPAN/ (note the last slash). Alternatively, you can start at http://www.cpan.org. The interface of this station is different, but the data is the same.



authors

This directory contains many subdirectories, one for each contributor. For example, if you want to find Lincoln Stein's well-written CGI modules (now part of the standard Perl version), and you happen to know that he wrote these modules, then you can look in the authors / Lincoln_stein directory . If you don't know who wrote these modules, you can find them in the modules directory described below.

doc

This directory holds all styles of Perl documentation, including several different arrangements and formats of Perl's official man pages, such as text, HTML, PostScript, and Perl's own pod format.

modules

This directory contains modules written in Perl or a mixture of Perl and C.

ports * This directory contains the source code, and sometimes there are some pre-compiled executable Perl ports, mainly for operating systems that are not directly supported in the standard version, or some difficult compilers. scripts * This directory contains a small variety of Perl programs sent from all over the world. They can be used as stand-alone programs or as examples. At present, there are not many programs listed here, but over time, this area will become more and more abundant. The Perl Power Tools project (Perl Universal Toolbox, PPT) is also placed here. The goal of PPT is to remake all Unix and tools in Perl. Most of the standards have been completed, and some less standard ones have also been completed.

src

In this directory, you can find the source code for the standard Perl distribution. In fact, there are two standard Perl versions of the source code, one marked stable and the other devel. (The index page of this directory is explained in detail.) They are all just links to the corresponding version. Earlier when we wrote these, stable.tar.gz was to perl-5.6.0.tar.gz (the usual solution is: if the second number of the version number is even, then it is the official version, if it is odd, Then it's a development version. The .tar.gz suffix sometimes is .tgz, indicating that it is a standard Internet format: a GNU compressed tar archive, often called a "tarball") symbolic link.

Install Perl Source
Copy the code:

$ wget http://www.cpan.org/src/5.0/perl-5.18.2.tar.gz
$ tar -xzf perl-5.18.2.tar.gz
$ cd perl-5.18.2
$ ./Configure -des -Dprefix = $ HOME / localperl
$ make
$ make test
$ make install

Install Perl's Module
Method 1: Install Manually
Suppose the DBI module is installed and placed in the / home / Bird directory.
Copy the code:

$ cd / home / Bird #Assuming this directory.
$ tar xvzf DBI-1.13.tar.gz # Unzip
$ cd DBI-1.13 #Enter the newly created directory
$ perl Makefile.PL #Generate Makefile
$ make #Build module
$ make test #test module
$ make install #Compile 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, then OK!
This method is suitable: when the installation package is ready. Most packages under Linux can be installed using this method! In special cases, you need to check the installation instructions.
Method 2: cpan installation
Copy the code:

perl -MCPAN -e shell
cpan> h #Get help
cpan> m #Get module
cpan [1]> i / DBI / #match search
cpan> install DBI #Install the module
cpan> q #Quit the installation

This method is suitable: the host is connected to the network without being walled!
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.