in reply to module test

There are several ways to do this. See perlfaq3: "How do I find which modules are installed on my system?" for a quick solution, or Super Search for others (this question is not uncommon).

Update: the approach suggested above will generate a list of all installed modules, which you can then search to see if a particular module is installed. If you want to take a more direct approach and test each module in question without generating the list of installed modules, Best way to check for installed module will give you ideas. The short answer is to just wrap the use in an eval and test for errors.

Replies are listed 'Best First'.
Re^2: module test
by Anonymous Monk on Apr 11, 2007 at 20:32 UTC
    Thank you! I figured it out with your help. Here is what I did:
    #!/usr/bin/perl -w use CGI::Carp qw(fatalsToBrowser); use CGI qw(:standard :cgi-lib); use strict; my @modules = qw( LWP::UserAgent My::Module Crypt::Blowfish Apache::Se +ssion::MySQL CGI CGI::Carp ); my ($_content, $mod); foreach $mod (@modules) { $_content .= qq~Checking "$mod"... ~; eval("use $mod"); if ($@) { $_content .= qq~$mod is NOT installed.~; $_content .= br() x 2; } else { $_content .= qq~$mod is installed.~; $_content .= br() x 2; } } print header(), start_html(-title=>"System Test"), $_content, end_html();