Search Docs by Keyword

Table of Contents

Perl

Introduction & Setup

Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl packages are provided by CPAN. For newer versions of Perl, we recommend installing via Spack.

cpan

The CPAN module and it’s command line tool (cpan) can be used to install modules by name from the CPAN repository. Additionally, it recursively installs any modules that it depends on. If you’re using the cpan command for the first time, you’ll need to run through a series of configuration prompts. Running the cpan command will initiate a configuration session.

You may be prompted at the end to manually set the download URL list. Use the o conf init urllist command to initiate the configuration.
Setting the download URL preferences from the cpan prompt

Setting the download URL preferences from the cpan prompt.

You may also want cpan to automatically install dependencies. This can either be set in the interactive configuration, or later at the cpan prompt using the command:

cpan> o conf prerequisites_policy follow

Once cpan is setup, either simple one line command at the terminal prompt can be used to install CPAN modules:

perl -MCPAN -e 'install DBD::SQLite'   OR   cpan DBD::SQLite

Of course, your module will be something other than ‘DBD::SQLite’

Alternatively, cpan can be run interactively.
CPAN module install from the interactive shell

CPAN module install from the interactive shell

Examples

FASRC User Codes

Tags:
© The President and Fellows of Harvard College
Except where otherwise noted, this content is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license.