[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 5596 - (download) (as text) (annotate)
Mon Dec 24 01:31:51 2007 UTC (5 years, 4 months ago) by gage
File size: 2774 byte(s)
added check for Exception::Class

    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   Email::Address
   51   Errno
   52   Exception::Class
   53   File::Copy
   54   File::Find
   55   File::Path
   56   File::Spec
   57   File::stat
   58   File::Temp
   59   GD
   60   Getopt::Long
   61   Getopt::Std
   62   HTML::Entities
   63   HTML::Tagset
   64   IO::File
   65   Iterator
   66   Iterator::Util
   67   Mail::Sender
   68   MIME::Parser
   69   MIME::Base64
   70   Net::IP
   71   Net::LDAPS
   72   Net::SMTP
   73   Opcode
   74   PHP::Serialization
   75   Pod::Usage
   76   Safe
   77   SOAP::Lite
   78   Socket
   79   SQL::Abstract
   80   String::ShellQuote
   81   Text::Wrap
   82   Time::HiRes
   83   Time::Zone
   84   URI::Escape
   85   XML::Parser
   86   XML::Parser::EasyTree
   87   XML::Writer
   88   XMLRPC::Lite
   89 );
   90 
   91 # modules used by disabled code
   92 # RQP::Render (RQP)
   93 # SOAP::Lite (PG::Remote)
   94 
   95 my $apache_version = shift @ARGV;
   96 unless (defined $apache_version and $apache_version =~ /^apache[12]$/) {
   97   warn "invalid apache version specified -- assuming apache1\n";
   98   warn "usage: $0 { apache1 | apache2 }\n";
   99   sleep 1;
  100   $apache_version = "apache1";
  101 }
  102 
  103 if ($apache_version eq "apache1") {
  104   push @modulesList, @apache1ModulesList;
  105 } elsif ($apache_version eq "apache2") {
  106   push @modulesList, @apache2ModulesList;
  107 }
  108 
  109 my @PATH = split(/:/, $ENV{PATH});
  110 check_apps(@applicationsList);
  111 
  112 check_modules(@modulesList);
  113 
  114 sub check_apps {
  115   my @applicationsList = @_;
  116   print "\nChecking your \$PATH for executables required by WeBWorK...\n";
  117 # print "\$PATH=", shift @PATH, "\n";    # this throws away the first item -- usually /bin
  118         print "\$PATH=";
  119   print join ("\n", map("      $_", @PATH)), "\n\n";
  120 
  121   foreach my $app (@applicationsList)  {
  122     my $found = which($app);
  123     if ($found) {
  124       print "   $app found at $found\n";
  125     } else {
  126       print "** $app not found in \$PATH\n";
  127     }
  128   }
  129 }
  130 
  131 sub which {
  132   my $app = shift;
  133   foreach my $path (@PATH) {
  134     return "$path/$app" if -e "$path/$app";
  135   }
  136 }
  137 
  138 sub check_modules {
  139   my @modulesList = @_;
  140 
  141   print "\nChecking your \@INC for modules required by WeBWorK...\n";
  142   my @inc = @INC;
  143   print "\@INC=";
  144   print join ("\n", map("     $_", @inc)), "\n\n";
  145 
  146   foreach my $module (@modulesList)  {
  147     eval "use $module";
  148     if ($@) {
  149       my $file = $module;
  150       $file =~ s|::|/|g;
  151       $file .= ".pm";
  152       if ($@ =~ /Can't locate $file in \@INC/) {
  153         print "** $module not found in \@INC\n";
  154       } else {
  155         print "** $module found, but failed to load: $@";
  156       }
  157     } else {
  158       print "   $module found and loaded\n";
  159     }
  160   }
  161 }

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9