Linux Tips for Installing Perl Modules in CPAN

  
                

Perl is a programming language, as powerful as C, and easy to use. However, Perl comes with fewer modules. Sometimes you need to download Perl modules from CPAN. How to install Perl from CPAN in Linux system operation? What about the module? Let's take a look at it with Xiaobian.

You can find the person you want any Perl modules from CPAN. Once you know the name of the Perl module you want to install (for example: (HTML::Template), you can install them as follows.

First, make sure your computer has C compiler installed. (for example: GCC compiler). Because most Perl modules are written in Perl, some use C to implement the underlying layer and then use XS language to handle the interaction. So you must install the Linux C development environment. Br>

Next, open a CPAN interactive interpreter and create and install a Perl module in the following way

$ sudo perl -MCPAN -e shell

cpan install HTML ::Template

Or use this method to

$ sudo perl -MCPAN -e ‘install HTML::Template’

If the above command is given “Can‘t locate CPAN.pm in @INC“'s error message, you first thought that you should use the standard Linux package manager command to install CPAN

For CentOS, Fedora or RHEL:

$ sudo yum -y insta Ll perl-CPAN

For Ubuntu and Debian:

$ sudo apt-get install perl-modules

You should now be able to manage other Perl with the perl -MPCAN command Modules.

Considering that some people will use proxy servers, they may have the need to use CPAN on the proxy server. You can use CPAN's console to configure your proxy server

$ sudo perl -MCPAN -e shell

cpan o conf init /proxy/

After the above command is executed, you will be asked to set up your proxy server. Finally, the system will let You can confirm whether your configuration is complete.

The above is the introduction of the Perl module on Linux CPAN. Because there are more Perl modules on CPAN, you can choose the Perl module you need to install.

Copyright © Windows knowledge All Rights Reserved