CPANM Installation and Perl module installation Tutorial _perl

Source: Internet
Author: User
Tags modifiers mongodb install perl

CPANM is the most convenient way to install Perl modules. Automatic Download installation Dependency pack. Using the CPAN shell or download source package to install the module, encountered a lot of dependencies, very headache. Here's one example:

Installing the MongoDB module

Copy Code code as follows:

# Perl makefile.pl
Warning:prerequisite class::method::modifiers 0 not found.
Warning:prerequisite data::types 0 not found.
Warning:prerequisite DateTime 0 not found.
Warning:prerequisite Datetime::tiny 0 not found.
Warning:prerequisite extutils::makemaker 6.59 not found. We have 6.30.
Warning:prerequisite file::slurp 0 not found.
Warning:prerequisite file::temp 0.17 not found. We have 0.16.
Warning:prerequisite JSON 0 not found.
Warning:prerequisite Moose 0 not found.
Warning:prerequisite test::exception 0 not found.
Warning:prerequisite Test::warn 0 not found.
Warning:prerequisite Tie::ixhash 0 not found.
Warning:prerequisite Try::tiny 0 not found.
Warning:prerequisite Boolean 0 not found.
Writing Makefile for MongoDB

1. Install Cpanm

CPANM is actually an executable file. Download it to the bin directory, and then add execution permissions.

Copy Code code as follows:

# wget http:
Xrl.us/cpanm-o/usr/bin/cpanm; chmod +X/USR/BIN/CPANM

2. Use CPANM installation module

Copy Code code as follows:

# cpanm-h
-V,--verbose turns on chatty output
-Q,--Quiet turns off the most output
--interactive Open Interactive configuration (required for Task:: Modules)
-F,--Force forced installation
-N,--notest do not run unit tests
--test-only only Test not installed
-S,--sudo sudo to run install commands
--installdeps only Install dependent modules
--showdeps Only show dependency information
--reinstall Reinstall
--MIRROR Specifies the mirror URL (e.g. http://cpan.cpantesters.org/)
--mirror-only downloads only from mirrors
--prompt prompt when Configure/build/test fails
-L,--local-lib Specify the install base to install modules
-L,--local-lib-contained Specify the install base to install all Non-core modules
--self-contained Install all Non-core modules, even if they ' re already installed.
--auto-cleanup number of days, CPANM ' s work directories expire in. Defaults to 7

Examples:
Cpanm Test::More # Install Test::More
CPANM miyagawa/plack-0.99_05.tar.gz # Full distribution path
Cpanm http://example.org/LDS/CGI.pm-3.20.tar.gz # Install from URL
Cpanm ~/dists/mycompany-enterprise-1.00.tar.gz # Install from a local file
Cpanm--interactive Task::kensho # Configure interactively
Cpanm. # Install from local directory
Cpanm--installdeps. # Install all of the Deps for the current directory
Cpanm-l extlib Plack # Install Plack and all Non-core deps to Extlib
CPANM--mirror Http://cpan.cpantesters.org/DBI # Use the fast-syncing mirror

Parameter name is directly the module name

For example, install the MongoDB module

Copy Code code as follows:

# CPANM MongoDB
--> Working on MongoDB
Fetching http://www.cpan.org/authors/id/F/FR/FRIEDO/MongoDB-0.702.0.tar.gz ... Ok
Configuring MongoDB-0.702.0 ... Ok
==> Found dependencies:datetime, Tie::ixhash, Data::types, Datetime::tiny, Class::method::modifiers, Boolean, Moose , File::slurp, Try::tiny, Test::exception, Extutils::makemaker, Test::warn, File::temp, JSON
--> Working on DateTime
.//Auto-Resolve dependent module

To speed up downloading, you can specify that you want to use mirroring and download only from mirrors:

Copy Code code as follows:

# CPANM--mirror http:
Mirrors.163.com/cpan--mirror-only MongoDB

3. Delete Module

Install App::p muninstall module:

Copy Code code as follows:

# CPANM APP::p muninstall

4. Delete Module

Copy Code code as follows:

# Pm-uninstall MongoDB

MongoDB.so:undefined Symbol:heutf8 Problem solution See: http://www.jb51.net/article/56285.htm

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.