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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7113 - (view) (download) (as text)

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

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9