Perl modules are a set of related variables and subroutines that perform a set of programming tasks. Interestingly, there are many Perl modules available in the Comprehensive Perl Archive Network (CPAN). So you can find different modules in different categories like network, XML processing, CGI, database interface, and so on. In this article, we try to deal with the Tutorial Install Perl Modules on Ubuntu Linux. You can see the packages available in Eldernode to purchase the Ubuntu VPS server.
Table of Contents
How to Install Perl Modules on Ubuntu Linux
CPAN, or Comprehensive Perl Archive, is a repository of modules written in Perl. There are several ways to install Perl modules from the comprehensive Perl archive network on Linux-based systems. The easiest way to install Perl modules is to use the CPAN module that we are going to cover. Follow us in the continuation of this article.
Install make packages on Ubuntu Linux
In this section, we try to learn how to install make packages on Ubuntu Linux. Many Perl installation tools and modules are available. In this article, we are going to try two tools cpan and cpanm to do this. Before you start anything, you need to make sure you have the “make” package installed on your Ubuntu.
Note: “make” is a basic tool for building Perl modules.
The “make” package is available in the default repositories of most Linux distributions. You can use the following command to install “make” on Ubuntu:
sudo apt install make
In the next section, we are going to install Perl modules in different ways. Stay with us.
How to Install Perl modules using CPAN
CPAN is a command-line client for the CPAN repository and is distributed by default with all versions of Perl.
sudo cpan
For example, to install the Net::DNS module, you must use the following command from the CPAN prompt:
install Net::DNS
You can also install the module directly using the following command:
sudo cpan Net::DNS
How to Install Perl modules using Cpanminus
Cpanminus or Cpanm is the CPAN client that is used to receive, open packages, build and install modules from the CPAN repository. Cpanm is a standalone script that requires zero-configuration. It should note that many professional developers prefer Perl Cpanm to CPAN. Cpanminus can be installed using 3 methods, which we will discuss in the following sections.
Using Perl to Install Cpanminus
You can easily use the following command to install the latest Cpanm version on Ubuntu. It should note that this command installs Cpanm at the system level. It also installs Cpanm binary in your bin directory like /usr/local/bin.
curl -L https://cpanmin.us | perl - --sudo App::cpanminus
Using distribution’s package manager to Install Cpanminus
Cpanm is available in the default Ubuntu distribution repositories. This is a stable version but a bit old. To install cpanminus on Ubuntu, just run the following command:
sudo apt install cpanminus
Manual Installation of Cpanminus
In this section, you can manually download the latest cpanm binary using the following commands and insert it in your $PATH. You must first download the latest version of cpanmin by running the following command:
curl -L https://cpanmin.us/ -o cpanm
Then run the following commands to install cpanmin:
chmod +x cpanm
sudo mv cpanm /usr/local/bin/cpanm
In this step you can install any Perl module, for example, Net::DNS, by running the following command:
sudo cpanm Net::DNS
How to Install missing Perl modules
Interestingly, many Perl modules are available as packages. You can use the distribution package manager to install these modules:
apt-cache search 'perl$' | grep Net::DNS
Conclusion
Perl is an interpretive, advanced, and object-oriented programming language used for server-side coding. This language uses Sed, Shell Script, and C in its structure and has its own properties. Perl is the tenth most popular programming language in the world and has been able to attract many fans. In this article, we tried to introduce you to the Tutorial Install Perl Modules on Ubuntu Linux.