how to check if a perl module is allready installed

In this sort tutorial, I will present a simple and easy way to check if a module in perl is installed in your system.

All the work is done by using a simple command:

perl -MModule::Name -e "print \"Module installed.\\n\";"

so for example if I want to check if the Module Net::LDAP::Control::Persistent is installed I have to run this command

perl -MNet::LDAP::Control::PersistentSearch -e "print \"Module installed.\\n\";"

In case that this module is Installed the console will print

Module installed

In case that this module is not installed the console will print something like this:

Can't locate Net/LDAP/Control/ in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.

Leave a Reply

Your email address will not be published. Required fields are marked *

Prove me that you are not a robot :) * Time limit is exhausted. Please reload the CAPTCHA.