Pages

Thursday, March 10, 2016

Check Presence of Perl Modules on linux

To check list of Perl modules installed on a Linux server below command can be helpful,

perl -MFile::Find=find -MFile::Spec::Functions -Tlw -e 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC' 

Below is sample output of command.

perl -MFile::Find=find -MFile::Spec::Functions -Tlw -e 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC' 

/usr/lib64/perl5/Data/Dumper.pm
/usr/lib64/perl5/XML/LibXML.pm
/usr/lib64/perl5/XML/LibXML/SAX.pm
/usr/lib64/perl5/XML/LibXML/Boolean.pm
/usr/lib64/perl5/XML/LibXML/NodeList.pm

/usr/lib64/perl5/XML/LibXML/Number.pm

Just to have understanding about the output, Say you are looking for module "Data::Dumper" then you should be able to see presence of file as "......../Data/Dumper.pm" as seen in above example.

Below is the quick command to  check for presence of a specific module.

perl -MFile::Find=find -MFile::Spec::Functions -Tlw -e 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC' |egrep -i 'data/dumper'

/usr/lib64/perl5/Data/Dumper.pm



No comments:

Post a Comment