"cpan" Command Line Tool

This section provides a quick introduction on the 'cpan' command, which uses the CPAN module to provide similar functionalities as the CPAN 'shell'.

Most Perl installations on Linux computers also provides a command line tool called "cpan". It uses the CPAN module and offers almost the same functionalities as the CPAN "shell".

Here are some examples of using the "cpan" command to install and manage Perl modules:

List installed modules:

herong$ cpan -l

PadWalker	2.5
DateTime	1.66
Ref::Util::XS	0.117
Devel::Caller	2.07
Devel::LexAlias	0.05
Test::LeakTrace	0.17
Test::LeakTrace::Script	undef
Package::Stash::XS	0.30
Class::XSAccessor	1.19
Class::XSAccessor::Heavy	1.19
Class::XSAccessor::Array	1.19
Digest::SHA1	2.13
Params::Util	1.102
Params::Util::PP	1.102
DateTime::Types	1.66
DateTime::Infinite	1.66
DateTime::PPExtra	1.66
...

Install a given Perl module with "root" privilege:

herong$ sudo cpan -i Imager

...
Installing /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/Imager.pm
Installing /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/Imager/Regops.pm
Installing /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/Imager/Draw.pod
...
Running Build test
t/00.load.t ............... 1/1 # Testing Parse::RecDescent 1.967015
t/00.load.t ............... ok
t/01.basics.t ............. ok
t/autotree.t .............. ok
...

All tests successful.
...

Display information for a given Perl module:

herong$ cpan -D Imager

Imager
-------------------------------------------------------------------------
	(no description)
	T/TO/TONYC/Imager-1.028.tar.gz
	/usr/local/lib/x86_64-linux-gnu/perl/5.26.1/Imager.pm
	Installed: 1.028
	CPAN:      1.028  up to date
	Tony Cook (TONYC)
	tony@develop-help.com

Search for CPAN modules with a keyword:

herong$ cpan -x image

Imager
Page
dmake
aze
...

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