[system] / branches / rel-2-4-dev / webwork2 / bin / check_modules.pl Repository:
ViewVC logotype

Annotation of /branches/rel-2-4-dev/webwork2/bin/check_modules.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4904 - (view) (download) (as text)
Original Path: trunk/webwork2/bin/check_modules.pl

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

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9