#!/usr/bin/perl ########################################################################## # Servertest.pl ########################################################################## # ----------------------------------------------------- # Check that all of the required modules can be located # --------------------------------- # Let's see what our environment is if (!$ENV{'SERVER_SOFTWARE'}) { $newline = "\n"; $cgimodule = "ftp.cpan.org/pub/perl/CPAN/modules/by-module/CGI/CGI.pm-2.56.tar.gz"; $lwpmod = "ftp.cpan.org/pub/perl/CPAN/modules/by-module/LWP/libwww-perl-5.47.tar.gz"; $httpmod = "ftp.cpan.org/pub/perl/CPAN/modules/by-module/HTTP/HTTP-Request-Form-0.5.tar.gz"; } else { print "Content-type: text/html\n\n"; $newline = "
"; $cgimodule = "ftp://ftp.cpan.org/pub/perl/CPAN/modules/by-module/CGI/CGI.pm-2.56.tar.gz"; $lwpmod = "ftp.cpan.org/pub/perl/CPAN/modules/by-module/LWP/libwww-perl-5.47.tar.gz"; $httpmod = "ftp.cpan.org/pub/perl/CPAN/modules/by-module/HTTP/HTTP-Request-Form-0.5.tar.gz"; } # -------------------------------------- # Check for the required version of PERL eval "require 5.004"; print "Checking PERL version..."; if ($@) { print "$newline"."This program requires at least PERL version 5.004 or greater.$newline"; exit 0; } print " OK$newline"; # ------------- # Check for CGI print "Checking for CGI..."; eval "use CGI"; if ($@) { print "$newline"."The CGI module could not be located. You will need to grab this module from $cgimodule and install it.$newline"; exit 0; } print " OK$newline"; # --------------------- # Check for HTTP print "Checking for HTTP..."; eval "use HTTP::Request"; if ($@) { print "$newline"."Could not find the HTTP::Request module. You will need to grab this module from $httpmod and install it.$newline"; exit 0; } print " OK$newline"; eval "use HTTP::Response"; if ($@) { print "$newline"."Could not find the HTTP::Response module. You will need to grab this module from $httpmod and install it.$newline"; exit 0; } print " OK$newline"; # --------------------- # Check for libwww-perl print "Checking for LWP..."; eval "use LWP::UserAgent"; if ($@) { print "$newline"."Could not find the LWP::UserAgent module. You will need to grab this module from $lwpmod and install it.$newline"; exit 0; } print " OK$newline"; print "Everything is in place and functional. You should be able to run the Personal Open Directory script on your server.\n"; print "Perl version: ".$]." CGI version: ".$CGI::VERSION.".";