Configure CPAN Shell

This section provides a tutorial on how to configure CPAN Shell to manage Perl module installations on macOS.

CPAN (Comprehensive Perl Archive Network) is is a repository of over 250,000 Perl modules, written by over 12,000 contributors. See CPAN Website at for more information.

CPAN Shell is Perl module that provides an shell interface to manage installations of CPAN Perl modules.

To use CPAN shell, you need to configure it first. Here is what I did on my macOS system.

1. Run the "perl -MCPAN -e shell" command:

herong$ perl -MCPAN -e shell requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes] yes

Warning: You do not have write permission for Perl library directories.

To install modules, you need to configure a local Perl library directory or
escalate your privileges.  CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available).  You may also
resolve this problem manually if you need to customize your setup.

What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')
[local::lib] sudo

Autoconfigured everything but 'urllist'.

Now you need to choose your CPAN mirror sites.  You can let me
pick mirrors for you, you can select them from a list or you
can enter them by hand.

Would you like me to automatically choose some CPAN mirror
sites for you? (This means connecting to the Internet) [yes] yes

Trying to fetch a mirror list from the Internet
Fetching with LWP:
Fetching with LWP:

Autoconfiguration complete.

commit: wrote '/Users/herong/.cpan/CPAN/'

You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.00)
Enter 'h' for help.

2. Get help on the CPAN Shell prompt:

cpan[1]> help

Display Information                                             (ver 2.00)
 command  argument          description
 a,b,d,m  WORD or /REGEXP/  about authors, bundles, distributions, modules
 i        WORD or /REGEXP/  about any of the above
 ls       AUTHOR or GLOB    about files in the author's directory

Download, Test, Make, Install...
 get     download                    clean   make clean
 make    make (implies get)          look    open subshell in dist directory
 test    make test (implies make)    readme  display these README files
 instal  make install (implies test) perldo  display POD documentation

 r       WORDs or /REGEXP/ or NONE   report updates for matching modules
 upgrade WORDs or /REGEXP/ or NONE   upgrade matching modules

 force  CMD    try hard to do command  fforce CMD    try harder
 notest CMD    skip testing

 h,?           display this menu       ! perl-code   eval a perl command
 o conf [opt]  set and query options   q             quit the cpan shell
 reload cpan   load again      reload index  load newer indices
 autobundle    Snapshot                recent        latest CPAN uploads

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