Dear List
I am trying to check some modules are installed or not in the system and if
modules are installed then trying to check their version number is according
to our requirement or not.

use strict;
use warning;
my @mod_info=("DBD::Oracle","abc","DBI","Parallel::ForkManager",);
my $module;
my $version;
my $install_module;

foreach $module(@mod_info)
{
        chomp($module);
         eval{$install_module = `$perl_path -e 'use $module'
2>>/dev/null`};
        if(defined $install_module)
        {
          print "$module is not installed in your system\n";
        }
        $version = `$perl_path  -M$module -e 'print "\$\$module::VERSION"'`;
        print $version."\n";
}

As there is no module by name abc the -- Can't locate abc.pm in @INC error
message is coming on the screen but when I am running this one liner from
command line I am not getting any error message on screen. Actually I want
to hold the return status in a variable then trying to do further work. How
this is possible? In the case of version checking I am not getting  any o/p
on screen .

One more thing I am aware of using * ExtUtils::Installed* in this scenario
but I don't want to use any module.

Thanks & Regards in advance
Anirban Adhikary

Reply via email to