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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 4889 Revision 4890
1#!/usr/bin/perl 1#!/usr/bin/perl
2 2
3use strict; 3use strict;
4use warnings; 4use warnings;
5
6my @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);
5 21
6my @apache1ModulesList = qw( 22my @apache1ModulesList = qw(
7 Apache 23 Apache
8 Apache::Constants 24 Apache::Constants
9 Apache::Cookie 25 Apache::Cookie
84 push @modulesList, @apache1ModulesList; 100 push @modulesList, @apache1ModulesList;
85} elsif ($apache_version eq "apache2") { 101} elsif ($apache_version eq "apache2") {
86 push @modulesList, @apache2ModulesList; 102 push @modulesList, @apache2ModulesList;
87} 103}
88 104
89my @applicationsList = qw( 105my @PATH = split(/:/, $ENV{PATH});
90 mkdir 106check_apps(@applicationsList);
91 mv
92 mysql
93 tar
94 latex
95 pdflatex
96 dvipng
97 tth
98 giftopnm
99 ppmtopgm
100 pnmtops
101 pnmtopng
102 pngtopnm
103);
104 107
105check_apps(@applicationsList);
106check_modules(@modulesList); 108check_modules(@modulesList);
109
107sub check_apps { 110sub check_apps {
108 my @applicationsList = @_; 111 my @applicationsList = @_;
109 print "\nChecking your \$PATH for executables required by WeBWorK...\n"; 112 print "\nChecking your \$PATH for executables required by WeBWorK...\n";
110 my @path = split(/:/, $ENV{PATH});
111 print "\$PATH=", shift @path, "\n"; 113 print "\$PATH=", shift @PATH, "\n";
112 print join ("\n", map(" $_", @path)), "\n\n"; 114 print join ("\n", map(" $_", @PATH)), "\n\n";
113 115
114 foreach my $app (@applicationsList) { 116 foreach my $app (@applicationsList) {
115 my $result = `which $app`; 117 my $found = which($app);
116 chomp($result); 118 if ($found) {
117 unless ($result =~ /\s*no/) {
118 print " $app found at $result\n"; 119 print " $app found at $found\n";
119 } else { 120 } else {
120 $result =~ s/\s*no//;
121 print "** $app not found in \$result\n"; 121 print "** $app not found in \$PATH\n";
122 } 122 }
123 } 123 }
124 124}
125 print "\nLoading Perl modules required by WeBWorK...\n"; 125
126 my @inc = @INC; 126sub which {
127 print "\@INC=", shift @inc, "\n"; 127 my $app = shift;
128 print join ("\n", map(" $_", @inc)), "\n\n"; 128 foreach my $path (@PATH) {
129 return "$path/$app" if -e "$path/$app";
130 }
129} 131}
130 132
131sub check_modules { 133sub check_modules {
132 my @modulesList = @_; 134 my @modulesList = @_;
135
136 print "\nChecking your \@INC for modules required by WeBWorK...\n";
137 my @inc = @INC;
138 print "\@INC=", shift @inc, "\n";
139 print join ("\n", map(" $_", @inc)), "\n\n";
140
133 foreach my $module (@modulesList) { 141 foreach my $module (@modulesList) {
134 eval "use $module"; 142 eval "use $module";
135 if ($@) { 143 if ($@) {
136 my $file = $module; 144 my $file = $module;
137 $file =~ s|::|/|g; 145 $file =~ s|::|/|g;

Legend:
Removed from v.4889  
changed lines
  Added in v.4890

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9