- How to resolve Perl module missing issue
- Know about CPAN (Comprehensive Perl Archive Network)
- Learn how to configure CPAN module (i.e, CPAN.pm)
Missing Perl Module
When a Perl script using IPTables::IPv4::IPQueue[1] was executed:
BEGIN { push @INC, "/scratch/perf/.../perl/5.8.8/x86_64-linux-thread-multi"; } use strict; use warnings; use IPTables::IPv4::IPQueue qw(:constants); |
It threw the following error message:[6]
- Can't locate IPTables/IPv4/IPQueue.pm in @INC (@INC contains:,,,
- /usr/local/lib64/perl5/auto/IPTables/IPv4/IPQueue
c pan[1]> force install IPTables::IPv4::IPQueue |
CPAN (Comprehensive Perl Archive Network)
CPAN is a software repository of over 150,929 modules written in the Perl programming language. The modules can be downloaded from metacpan.org and also from mirrored sites worldwide. The resources found on CPAN are easily accessible with the CPAN.pm module.
From metacpan.org home page, you can search for any Perl Module you need. For example, enter "IPTables::IPv4" in the search field. You will find the documentation for IPTables::IPv4 here.
CPAN Module (CPAN.pm)
The resources found on CPAN are easily accessible with the CPAN.pm module. If you want to use CPAN module, you use CPAN shell, which provides an interactive mode, in two ways:
perl -MCPAN -e shell |
cpan |
Configuration Steps
If you want to use CPAN.pm, lots of things have to be configured. So, when you use it the first time, you will be prompted to configure them. After the configuration, don't forget to commit by entering:
cpan[19]> o conf commit
|
to make the configuration permanent, which configuration data will be logged into below file:
- /usr/share/perl5/CPAN/Config.pm
Only one CPAN process can be run at a time and this is protected by a mechanism using below lock:
- /root/.cpan/.lock
How to Connect to the Internet behind a Proxy
After the first-time configuration effort, you can still modify configured data by entering:
cpan[20]> o conf init
|
- As you did not allow me to connect to the internet you need to supply a valid CPAN URL now.
To work around, you can configure a proxy for CPAN by entering:[4,5]
cpan[21]> o conf init /proxy/
If you're accessing the net via proxies, you can specify them in the CPAN configuration or via environment variables. The variable in the $CPAN::Config takes precedence. Your ftp_proxy? [] |
At the "Your http_proxy? " prompt, we have entered the following:
- http://146.xx.xx.29:80
and it works fine afterwards. Besides proxy configuration, you may also want to configure a urllist to specify which mirror(s) to use for downloading:
cpan[22]> o conf init urllist
|
There are 235 registered sites around the world make up the N part of CPAN (the Network), you can find the full list here.
References
- IPTables::IPv4::IPQueue - Perl extension for libipq.
- /usr/include is where libipq.h should be located (see here for its usage case)
- CPAN Mirror Network
- Installing CPAN Perl Modules Revisited
- Using CPAN with a proxy failing after o conf init /proxy/
- lwp https requests via proxy
- How do I include a Perl module that's in a different directory?
- ipq: [Unknown error: Device or resource busy]
- Try to reboot your Linux box
1 comment:
Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating Hadoop Admin Online Training
Post a Comment