Home

Search this site:
 

Horshack’s
very
own site

 

This is Bavaria, Germany!
You will find links to Perl,
bootdisks for system administration,
a lot of Linux,
Windows administration
and some personal belongings.
Are all perl-modules installed?

Are all perl-modules installed?

This is good to know on webserver where you usually do not have shell-access to find out. You transfer this program to your webserver and it tells you wether all modules in @libraries are installed. It looks like this:
    This is moduletest.pl Version 1.00

    Loading modules...
    Loading strict.pm...successful
    Loading Net/SMTP.pm...not successful
    Loading MIME/Lite.pm...not successful
    End of modultest.pl
#!/usr/bin/perl
use strict;
use warnings;
my $version = "1.000.000";

# Add PATH for my own libraries
use lib '.';

my @libraries = (
    "strict.pm",       # not "strict"
    "Net/SMTP.pm",     # not "Net::SMTP"
    "MIME/Lite.pm",    # not "MIME::Lite"
);

print "Content-Type: text/html\n\n";
printf "<html><head><title>Checking perl-modules</title></head>\n";
print "<h1>Checking perl-modules</h1>\n";
print "Loading all modules...<br />\n";
&loadmodules( modules => \@libraries );
print "End of $0<br />";
exit;

sub loadmodules {
    my (%args) = @_;
    my @modules = @{ $args{modules} };
    foreach my $module (@modules) {
        print "Loading $module...";
        if ( eval "require \"$module\"" ) {
            print "successful<br />\n";
        }
        else {
            print "<b>not</b> successful<br />\n";
        }
    }
}

Impressum