[system] / trunk / webwork2 / bin / check_modules.pl Repository:
ViewVC logotype

View of /trunk/webwork2/bin/check_modules.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5018 - (download) (as text) (annotate)
Fri Jun 22 16:56:50 2007 UTC (5 years, 10 months ago) by apizer
File size: 2679 byte(s)
add gzip to list of apps to check for

    1 #!/usr/bin/perl
    2 
    3 use strict;
    4 use warnings;
    5 
    6 my @applicationsList = qw(
    7   mkdir
    8   mv
    9   mysql
   10   tar
   11   gzip
   12   latex
   13   pdflatex
   14   dvipng
   15   tth
   16   giftopnm
   17   ppmtopgm
   18   pnmtops
   19   pnmtopng
   20   pngtopnm
   21 );
   22 
   23 my @apache1ModulesList = qw(
   24   Apache
   25   Apache::Constants
   26   Apache::Cookie
   27   Apache::Log
   28   Apache::Request
   29 );
   30 
   31 my @apache2ModulesList = qw(
   32   Apache2::Request
   33   Apache2::Cookie
   34   Apache2::ServerRec
   35   Apache2::ServerUtil
   36 );
   37 
   38 my @modulesList = qw(
   39   Benchmark
   40   Carp
   41   CGI
   42   Data::Dumper
   43   Data::UUID
   44   Date::Format
   45   Date::Parse
   46   DateTime
   47   DBD::mysql
   48   DBI
   49   Digest::MD5
   50   Errno
   51   File::Copy
   52   File::Find
   53   File::Path
   54   File::Spec
   55   File::stat
   56   File::Temp
   57   GD
   58   Getopt::Long
   59   Getopt::Std
   60   HTML::Entities
   61   HTML::Tagset
   62   IO::File
   63   Iterator
   64   Iterator::Util
   65   Mail::Sender
   66   MIME::Parser
   67   MIME::Base64
   68   Net::IP
   69   Net::LDAPS
   70   Net::SMTP
   71   Opcode
   72   PHP::Serialization
   73   Pod::Usage
   74   Safe
   75   SOAP::Lite
   76   Socket
   77   SQL::Abstract
   78   String::ShellQuote
   79   Text::Wrap
   80   Time::HiRes
   81   Time::Zone
   82   URI::Escape
   83   XML::Parser
   84   XML::Parser::EasyTree
   85   XML::Writer
   86   XMLRPC::Lite
   87 );
   88 
   89 # modules used by disabled code
   90 # RQP::Render (RQP)
   91 # SOAP::Lite (PG::Remote)
   92 
   93 my $apache_version = shift @ARGV;
   94 unless (defined $apache_version and $apache_version =~ /^apache[12]$/) {
   95   warn "invalid apache version specified -- assuming apache1\n";
   96   warn "usage: $0 { apache1 | apache2 }\n";
   97   sleep 1;
   98   $apache_version = "apache1";
   99 }
  100 
  101 if ($apache_version eq "apache1") {
  102   push @modulesList, @apache1ModulesList;
  103 } elsif ($apache_version eq "apache2") {
  104   push @modulesList, @apache2ModulesList;
  105 }
  106 
  107 my @PATH = split(/:/, $ENV{PATH});
  108 check_apps(@applicationsList);
  109 
  110 check_modules(@modulesList);
  111 
  112 sub check_apps {
  113   my @applicationsList = @_;
  114   print "\nChecking your \$PATH for executables required by WeBWorK...\n";
  115   print "\$PATH=", shift @PATH, "\n";
  116   print join ("\n", map("      $_", @PATH)), "\n\n";
  117 
  118   foreach my $app (@applicationsList)  {
  119     my $found = which($app);
  120     if ($found) {
  121       print "   $app found at $found\n";
  122     } else {
  123       print "** $app not found in \$PATH\n";
  124     }
  125   }
  126 }
  127 
  128 sub which {
  129   my $app = shift;
  130   foreach my $path (@PATH) {
  131     return "$path/$app" if -e "$path/$app";
  132   }
  133 }
  134 
  135 sub check_modules {
  136   my @modulesList = @_;
  137 
  138   print "\nChecking your \@INC for modules required by WeBWorK...\n";
  139   my @inc = @INC;
  140   print "\@INC=", shift @inc, "\n";
  141   print join ("\n", map("     $_", @inc)), "\n\n";
  142 
  143   foreach my $module (@modulesList)  {
  144     eval "use $module";
  145     if ($@) {
  146       my $file = $module;
  147       $file =~ s|::|/|g;
  148       $file .= ".pm";
  149       if ($@ =~ /Can't locate $file in \@INC/) {
  150         print "** $module not found in \@INC\n";
  151       } else {
  152         print "** $module found, but failed to load: $@";
  153       }
  154     } else {
  155       print "   $module found and loaded\n";
  156     }
  157   }
  158 }

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9