Install Perl Module with CPAN Shell

This section provides a tutorial on how to install a CPAN Perl module automatically with CPAN Shell.

The best way to install a Perl module from CPAN (Comprehensive Perl Archive Network) is to use the CPAN Shell. Here is what I did to install the Imager module with CPAN Shell.

1. Start the CPAN Shell:

herong$ sudo perl -MCPAN -e shell
...
cpan[1]>

2. Run the "install" command to install the Imager module:

cpan[1]> install Imager
Reading '/Users/herong/.cpan/sources/authors/01mailrc.txt.gz'
...
...............................................................DONE
DONE
Writing /Users/herong/.cpan/Metadata
Running install for module 'Imager'
Running make for T/TO/TONYC/Imager-1.011.tar.gz
...
  Has already been unwrapped into directory
     /Users/herong/.cpan/build/Imager-1.011-KJVmoX
  CPAN.pm: Building T/TO/TONYC/Imager-1.011.tar.gz
...
cp feat.h blib/lib/Imager/include/feat.h
cp lib/Imager/Install.pod blib/lib/Imager/Install.pod
cp lib/Imager/LargeSamples.pod blib/lib/Imager/LargeSamples.pod
...
Installing /Library/Perl/5.18/darwin-thread-multi-2level/Imager.pm
Installing /Library/Perl/5.18/darwin-thread-multi-2level/Imager/API.pod
Installing /Library/Perl/5.18/darwin-thread-multi-2level/Imager/APIRef.pod
...
TONYC/Imager-1.011.tar.gz
sudo /usr/bin/make install  -- OK

3. Run the "m" command to verify installation:

cpan[2]> m Imager
Module id = Imager
    CPAN_USERID  TONYC (Tony Cook <tony@develop-help.com>)
    CPAN_VERSION 1.011
    CPAN_FILE    T/TO/TONYC/Imager-1.011.tar.gz
    UPLOAD_DATE  2019-03-07
    MANPAGE      Imager - Perl extension for Generating 24 bit Images
    INST_FILE    /Library/Perl/5.18/darwin-thread-multi-2level/Imager.pm

Note that you should always use "root" privilege to install Perl modules to avoid permission issues.

Table of Contents

 About This Book

 Perl on Linux Systems

 Perl on macOS Computers

 ActivePerl on Windows Systems

 Data Types: Values and Variables

 Expressions, Operations and Simple Statements

 User Defined Subroutines

 Perl Built-in Debugger

 Name Spaces and Perl Module Files

 Symbolic (or Soft) References

 Hard References - Addresses of Memory Objects

 Objects (or References) and Classes (or Packages)

 Typeglob and Importing Identifiers from Other Packages

 String Built-in Functions and Performance

 File Handles and Data Input/Output

 Open Files in Binary Mode

 Open Directories and Read File Names

 File System Functions and Operations

 Image and Picture Processing

 Using DBM Database Files

 Using MySQL Database Server

 Socket Communication Over the Internet

 XML::Simple Module - XML Parser and Generator

 XML Communication Model

 SOAP::Lite - SOAP Server-Client Communication Module

 Perl Programs as IIS Server CGI Scripts

 CGI (Common Gateway Interface)

 XML-RPC - Remote Procedure Call with XML and HTTP

 RPC::XML - Perl Implementation of XML-RPC

 Integrating Perl with Apache Web Server

 CGI.pm Module for Building Web Pages

 LWP::UserAgent and Web Site Testing

 Converting Perl Script to Executable Binary

CPAN (Comprehensive Perl Archive Network)

 What Is CPAN

Install Perl Module with CPAN Shell

 "cpan" Command Line Tool

 CPAN Local Directories and Files

 Archived Tutorials

 References

 Full Version in PDF/EPUB