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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9