- Perl is a family of high-level, general-purpose, interpreted, dynamic programming languages. The languages in this family include Perl 5 and Raku (formerly Perl 6).
- The Perl languages borrow features from other programming languages including C, shell script (sh), AWK, and sed. They provide powerful text processing facilities without the arbitrary data-length limits of many contemporary Unix commandline tools, facilitating easy manipulation of text files. Perl 5 gained widespread popularity in the late 1990s as a CGI scripting language, in part due to its then unsurpassed regular expression and string parsing abilities.
Install the package.
The Perl language interpreter:
Perl bug reporting:
Lookup the Perl documentation in POD format:
Send the Perl authors and maintainers a thank you message:
The Comprehensive Perl Archive Network (CPAN) is a repository of over 250,000 software modules and accompanying documentation written in the Perl programming language by over 12,000 contributors.
CPAN is also the name of a Perl module, CPAN.pm, which is used to download and install Perl software from the CPAN archive.
pacman and AUR
The CPAN.pm module is included with Perl. It can be used interactively from the shell or in Perl scripts.
Before first use, the module needs to be configured. This is done interactively from the shell with (some output omitted):
CPAN.pm 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]
Automated configuration will suit most users. Answering yes, the configuration will continue with:
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]
If you want
cpan to install modules in your home directory choose
local::lib. To install them system-wide choose
sudo the configuration ends:
Autoconfiguration complete. commit: wrote '/home/username/.cpan/CPAN/MyConfig.pm'
local::lib option will result in addition modules being installed.
Choosing not to use automated configuration allows the user to set
cpan options interactively in the shell. The table below shows some option names with a brief description and default value. More detailed information is displayed for each option during configuration.
|cpan_home||CPAN build and cache directory||$HOME/.cpan|
|keep_source_where||Download target directory||$HOME/.cpan/sources|
|build_dir||Build process directory||$HOME/.cpan/build|
|prefs_dir||Customizable modules options directory||$HOME/.cpan/prefs|
|build_cache||Cache size for build directory||100MB|
|cleanup_after_install||Remove build directory after successful install||No|
|halt_on_failure||Halt on failure||No|
|colorize_output||Turn on colored output||No|
|histfile||History file location||$HOME/.cpan/histfile|
|histsize||History file size||100 lines|
The configuration file $HOME/.cpan/CPAN/MyConfig.pm can be edited with your text editor of choice.
To simply install a modules pass them as parameters to
cpan (multiple module names are separated by spaces):
$ cpan Acme::MetaSyntactic
The following examples are all in the
cpan interactive shell, started with:
Display information on a module:
cpan> m Acme::MetaSyntactic
Reading '/home/username/.cpan/Metadata' Database was generated on Fri, 08 Dec 2017 02:17:03 GMT Module id = Acme::MetaSyntactic CPAN_USERID BOOK (Philippe Bruhat (BooK) <firstname.lastname@example.org>) CPAN_VERSION 1.014 CPAN_FILE B/BO/BOOK/Acme-MetaSyntactic-1.014.tar.gz INST_FILE (not installed)
View module README:
cpan> readme Acme::MetaSyntactic
Acme::MetaSyntactic - Themed metasyntactic variables DESCRIPTION When writing code examples, it's always easy at the beginning: my $foo = "bar"; $foo .= "baz"; # barbaz ...
Install a module:
cpan> install Acme::MetaSyntactic
The following widget toolkit bindings are available:
- gtk2-perl — GTK2 bindings
- perl-gtk3 — GTK3 bindings
- Perl/TK — Tk bindings
- perlqt — Qt bindings
- wxPerl — wxWidgets bindings
- http://www.wxperl.it/ || AUR
- Prima — a perl multiplatform graphic toolkit
To use these with Perl, you may need to install the associated widget kits.
Tips and tricks
Improved module management
cpanminus extends module management and aims to be zero configuration and integrates with
Install the package.
The cpanminus documentation gives examples.
ucpan is a nice, fully automatic updater for CPAN modules (especially installed in local-lib). To install use:
Installing the Bundle::CPAN distribution will add a lot of nice functionality to CPAN.pm.
$ cpan Bundle::CPAN
Re-run cpan configuration
$ cpan cpan> o conf init
Create new module
Module::Starter helps you create your new module... Install:
module-starter --module=App::foobar --author="My name here" --email@example.com --mb
This going to create your module tree...
--mbcreate module which will use Module::Build. The next part assumes that you are using this module.
To add dependiences, put
module_name => version_or_0 inside
$builder -> requires in file
To install required dependiences for your project, run inside
cpanm --installdeps .
To skip git folder, add under
add_to_manifest_skip => [ '.git' ],
Adding scripts can by done like this:
mkdir bin touch bin/foobar
To run this script:
perl -Ilib bin/foobar
You can change your project version here:
To install your module run this command in module root folder:
- The Raku Programming Language
- Getting started with Perl 6
- Comprehensive Perl Archive Network
- CPAN / CPAN Shell / CPANPLUS Quick Reference Guide