#!/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"; $urimod = "ftp.cpan.org/pub/perl/CPAN/modules/by-module/URI/URI-1.04.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"; $urimod = "ftp.cpan.org/pub/perl/CPAN/modules/by-module/URI/URI-1.04.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 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 module. You will need to grab this module from $lwpmod and install it.$newline"; exit 0; } print " OK$newline"; # --------------------- # Check for fcntrl print "Checking for Fcntl..."; eval "use Fcntl"; if ($@) { print "$newline"."Could not find the Fcntl module. $newline"; exit 0; } print " OK$newline"; # ------------------------- # Check for URI print "Checking for URI..."; eval "use URI::Escape"; if ($@) { print "$newline"."Could not find URI. You will need to grab this module from $urimod and install it.$newline"; exit 0; } print " OK$newline"; print qq~ Everything is in place and functional. You can run POD. ~;