in reply to Re: checking for all packages
in thread checking for all packages

Quickly this morning I simply wrote out a file to temp with all of the non-core Perl modules that will be used.
use Net::IP; use Net::CIDR; use List::BinarySearch;
then
$rc = `perl -c /tmp/perltest.pl`;
But this will fail on the 1st missing module and not check the next 2. I am hoping there is a 'pattern' or typical usage with 'eval', a 'foreach' and a list of module names.
Plagiarism is the highest form if flattery.

It is always better to have seen your target for yourself, rather than depend upon someone else's description.

Replies are listed 'Best First'.
Re^3: checking for all packages
by aitap (Curate) on May 16, 2014 at 19:54 UTC
    Given an array of module names, you can use UNIVERSAL::require to check for their presence:
    require UNIVERSAL::require; my @modules_to_check = qw(Net::IP Net::CIDR List::BinarySearch); for my $module (@modules_to_check) { $module->require or warn "$module failed to load\n"; }
Re^3: checking for all packages
by vinoth.ree (Monsignor) on May 16, 2014 at 19:49 UTC

    Hi,

    Instead of using those modules with use, you can try with perldoc command (check perldoc already installed) You can check for a module's installation path by: perldoc -l ourmodule::name

    Have it list of packages in array, use foreach loop and execute perldoc command and check. perldoc -l will return the only the file name of the module found.

    Getting the CPAN dependency tree of a Perl module

    All is well