Perl is an old and popular scripting language. Todays Python is preferred over Perl but there are a lot of useful tools used already by system administrators. There is generally a problem of dependency for Perl scripts. Here we will look at how to install required Perl modules into Linux.
Perl是一种古老而流行的脚本语言。 今天的Python比Perl更受青睐,但是系统管理员已经使用了许多有用的工具。 通常,Perl脚本存在依赖性问题。 在这里,我们将研究如何将所需的Perl模块安装到Linux中。
通过CPAN安装 (Install Via CPAN)
CPAN is a very good solution to install modules. It resolves and installs dependencies easily. CPAN is very easy to use versus installing modules manually.
CPAN是安装模块的非常好的解决方案。 它可以轻松解决并安装依赖项。 与手动安装模块相比,CPAN非常易于使用。
CentOS,Fedora,Red Hat (CentOS, Fedora, Red Hat)
We can install CPAN in rpm-based distributions like CentOS, Fedora and Red Hat like below.
我们可以将CPAN安装在基于rpm的发行版中,例如CentOS,Fedora和Red Hat,如下所示。
$ sudo yum install perl-CPAN.noarch
Ubuntu,Debian,Mint,Kali (Ubuntu, Debian, Mint, Kali)
We can use following command in order to install CPAN in deb based distributions like Debian, Ubuntu, Kali, and Mint.
我们可以使用以下命令来在基于Deb的发行版(如Debian,Ubuntu,Kali和Mint)中安装CPAN。
$ sudo apt-get install libpath-tiny-perl

安装MIME (Install MIME)
We have installed the CPAN and we can use CPAN interactive shell in order to install MIME::Lite
package. First, we will enter to the CPAN interactive shell.
我们已经安装了CPAN,并且可以使用CPAN交互式外壳程序来安装MIME::Lite
包。 首先,我们将进入CPAN交互式外壳。
$ cpan

# cpan> install MIME::Lite

从Bash使用CPAN安装Perl模块 (Install Perl Modules With CPAN From Bash)
We can run the installation process without entering CPAN shell-like below.
我们可以运行安装过程,而无需在下面输入CPAN shell。
$ sudo cpan -i MIME::Lite
-i
parameter simple provides install command like in CPAN shell.
-i
参数simple提供类似于CPAN shell中的安装命令。

翻译自: https://www.poftut.com/how-to-install-perl-modules-with-cpan/