Install Perl Module from CPAN

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

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$ perl -MCPAN -e shell

2. Install the Imager module:

cpan[1]> install Imager
Reading '/Users/herong/.cpan/sources/authors/01mailrc.txt.gz'
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 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/
Installing /Library/Perl/5.18/darwin-thread-multi-2level/Imager/API.pod
Installing /Library/Perl/5.18/darwin-thread-multi-2level/Imager/APIRef.pod
sudo /usr/bin/make install  -- OK

3. Verify installation:

cpan[2]> m Imager
Module id = Imager
    CPAN_USERID  TONYC (Tony Cook <>)
    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/

Table of Contents

 About This Book

 Perl on Linux Systems

 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 Module for Building Web Pages

 LWP::UserAgent and Web Site Testing

 Converting Perl Script to Executable Binary

Managing Perl Engine and Modules on macOS

 Perl Version Pre-Installed on macOS

 Install Xcode Command Line Tools

 Configure CPAN Shell

Install Perl Module from CPAN

 Install Perl Module from Source Code

 Archived Tutorials


 Full Version in PDF/EPUB