Hey !! There is a Perl module ExtUtils::Installed for this kind of job. You should install it from cpan.
my $Inst = ExtUtils::Installed->new();
my @Modules = $Inst->modules();
print "Current List of Installed PERL Modules:\n\n";
foreach my $modName(@Modules){
print "$modName\n";
}
Cheers
Hi Neelam,
If you would like to just check the specific module installed in your system, try this
perl -M<Module_name> -le 'print 1'
For example : To check Regexp::Common
perl -MRegexp::Common -le 'print 1'
If you get “1″ as the output, then the specified perl module is installed. If not, you’ll get the error message.
Cheers
You can try this:
perl -MFile::Find=find -MFile::Spec::Functions -Tlw -e 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC'
In above Perl Oneliner
File::Find and File::Spec::Functions module are used to list all installed modules.
-M option loads the module. It executes use module before executing the script
-T option enables taint checking, which instructs perl to keep track of data from the user and avoid doing anything insecure with it. Here this option is used to avoid taking the current directory name from the @INC variable and listing the available .pm files from the directory recursively.
-l option enables automatic line-ending processing in the output. Print statements will have the new line separator (\n) added at the end of each line.
-w option prints any warning messages.
-e option indicates that the following string is to be interpreted as a perl script (i.e., sequence of commands).
Hope this will help.