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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9