[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 5018 - (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 :     Errno
51 :     File::Copy
52 : sh002i 3985 File::Find
53 : sh002i 2432 File::Path
54 : sh002i 3985 File::Spec
55 :     File::stat
56 : sh002i 2432 File::Temp
57 : sh002i 3987 GD
58 : sh002i 3985 Getopt::Long
59 :     Getopt::Std
60 : sh002i 2432 HTML::Entities
61 : gage 4807 HTML::Tagset
62 : sh002i 3985 IO::File
63 : gage 4807 Iterator
64 :     Iterator::Util
65 : sh002i 2432 Mail::Sender
66 : gage 4807 MIME::Parser
67 : sh002i 3985 MIME::Base64
68 : glarose 4904 Net::IP
69 : gage 4194 Net::LDAPS
70 : sh002i 3987 Net::SMTP
71 : sh002i 2432 Opcode
72 : gage 4194 PHP::Serialization
73 : sh002i 3985 Pod::Usage
74 : sh002i 2432 Safe
75 : gage 4194 SOAP::Lite
76 : sh002i 3985 Socket
77 : gage 4807 SQL::Abstract
78 : sh002i 3985 String::ShellQuote
79 : sh002i 2432 Text::Wrap
80 :     Time::HiRes
81 : sh002i 3985 Time::Zone
82 : sh002i 2432 URI::Escape
83 :     XML::Parser
84 :     XML::Parser::EasyTree
85 :     XML::Writer
86 : gage 4194 XMLRPC::Lite
87 : gage 2329 );
88 :    
89 : sh002i 3985 # modules used by disabled code
90 :     # RQP::Render (RQP)
91 :     # SOAP::Lite (PG::Remote)
92 :    
93 : sh002i 4889 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 : sh002i 4890 my @PATH = split(/:/, $ENV{PATH});
108 :     check_apps(@applicationsList);
109 : gage 2329
110 : gage 4807 check_modules(@modulesList);
111 : sh002i 4890
112 : gage 4807 sub check_apps {
113 :     my @applicationsList = @_;
114 :     print "\nChecking your \$PATH for executables required by WeBWorK...\n";
115 : sh002i 4890 print "\$PATH=", shift @PATH, "\n";
116 :     print join ("\n", map(" $_", @PATH)), "\n\n";
117 : gage 4807
118 :     foreach my $app (@applicationsList) {
119 : sh002i 4890 my $found = which($app);
120 :     if ($found) {
121 :     print " $app found at $found\n";
122 : gage 4807 } else {
123 : sh002i 4890 print "** $app not found in \$PATH\n";
124 : gage 4807 }
125 : gage 2329 }
126 : sh002i 4890 }
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 : gage 4807
138 : sh002i 4890 print "\nChecking your \@INC for modules required by WeBWorK...\n";
139 : gage 4807 my @inc = @INC;
140 :     print "\@INC=", shift @inc, "\n";
141 :     print join ("\n", map(" $_", @inc)), "\n\n";
142 : sh002i 4890
143 : gage 4807 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 : sh002i 3985 } else {
155 : gage 4807 print " $module found and loaded\n";
156 : sh002i 3985 }
157 : gage 2329 }
158 : sh002i 4889 }

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9