How to check if Perl module is installed

How to check if Perl module is installed

To verify if a specific perl module is installed on the server/ready for use, you can execute this command from shell:

perl -e "use Themodulename::Here"

For example, let's test if Zlib is installed "A core Perl module installed by default on all systems"

[root@carbondev ~]# perl -e "use Compress::Zlib"
[root@carbondev ~]#

The output will look like above, showing no errors in calling a use function. If the module is not installed however you'll see something like below output:

[root@carbondev ~]# perl -e "use Soap::Lite"
Can't locate Soap/Lite.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.