#!/usr/bin/perl @modnames = qw / CGI Test::Simple Foo::Bomb Test::More / ; print "Testing for Modules: @modnames\n\n" ; open STDERR, '>/dev/null' ; foreach $module ( @modnames ) { open OTHERSELF, '>REAL.pl' ; print OTHERSELF qq/use $module;\n print "succeeded $module\n" / ; # With SRDERR directed to devnull a value needs # to be returned to STDOUT, the print provides # a value that can be used in determining success. close OTHERSELF ; print "Trying $module\n" ; $result = `perl REAL.pl` ; if ( $result =~ m/succeeded/i ) { print "Successfully Loaded $module \n" } else { print "\n>>>> Failed to Load $module \n\n" } }