How to install the Perl module in Linux/Unix

Source: Internet
Author: User

Method 1. Steps for manual Installation

Download the dbi-1.13.tar.gz compressed file dbi-1.13.tar.gz from cpan, and place it under/usr/local/src.
CD/usr/local/src
Decompress the file:
Tar xvzf DBI-1.13.tar.gz
A new DBI-1.13 directory is created.
CD DBI-1.13

Generate makefile:
Perl makefile. pl
Create a module
Make
Test Module
Make Test
If the test result reports "all test OK", you can install the compiled module with confidence. Before installing a module
Make sure that you have the write permission on the perl5 installation directory (usually obtained using the su command) and execute:
Make install

Now, writeProgramTry it.

#! /Usr/bin/perl-W
Use strict;
Use dBi;
..

The preceding steps are applicable to the vast majority of Perl modules in Linux/Unix. There may be a slight difference in the installation methods of a few modules, so it is best to first look at the README or install in the installation directory. In addition, the above process is for the dynamic link Perl Compiler (all preinstalled Perl in Linux are dynamically linked). If you are using a static link Perl, you need to statically link the new module to the Perl compiler and restart the machine.

Method 2: Use the CPAN module for automatic installation:

Before installation, you must connect to the Internet and obtain the root permission.
Perl-mcpan-e Shell
When you run CPAN for the first time, you need to make some settings. If your machine is directly connected to the Internet (Dial-Up, leased line, etc .), just press enter to select a CPAN image site closest to you. For example, I chose the domestic China free software library ftp://freesoft.cgi.gov.cn/pub/?ages/perl/cpan. Otherwise, if your machine is behind the firewall, you need to set up an FTP proxy or HTTP proxy.

Get help
CPAN> H

List all modules on CPAN
CPAN> m

Search for a module on CPAN Based on the Keyword:
CPAN [1]> I/scws/
CPAN: storable loaded OK (v2.20)
Going to read '/home/orisun/. CPAN/metadata'
Database was generated on SAT, 17 Nov 2012 08:07:03 GMT
Distribution xueon/Text-Scws-0.01.tar.gz
Module text: scws (xueon/Text-Scws-0.01.tar.gz)
2 items found

Installation Module
CPAN> install DBI
The entire process from downloading to installing the DBI module is automatically completed.

Exit
CPAN> q

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.