[system] / trunk / webwork2 / clients / checkProblem.pl Repository:
ViewVC logotype

View of /trunk/webwork2/clients/checkProblem.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4182 - (download) (as text) (annotate)
Wed Jun 28 21:09:10 2006 UTC (6 years, 10 months ago) by gage
File size: 1129 byte(s)
These scripts will step through the problemLibrary and check each problem to see if the create WARNING messages when run.

The scripts are still a bit fragile -- use with caution.

VS: ----------------------------------------------------------------------

    1 #!/usr/bin/perl -w
    2 
    3 =pod
    4 
    5 This script will take a command and an input
    6 file.
    7 
    8 It will list available libraries, list the contents of libraries
    9 or render the input file.
   10 
   11 All of this is done by contacting the webservice.
   12 
   13 
   14 
   15 =cut
   16 use constant LOG_FILE => '/Volumes/Riemann/webwork/problemLibraries/bad_problems.txt';
   17 use XMLRPC::Lite;
   18 use MIME::Base64 qw( encode_base64 decode_base64);
   19 require "/Volumes/Riemann/webwork/head/webwork2/clients/webwork_xmlrpc_inc.pl";
   20 
   21 our $source = '';
   22 
   23 if (@ARGV) {
   24     $source = (defined $ARGV[0]) ? `cat $ARGV[0]` : '' ;
   25     my $command = 'renderProblem';
   26   my $rh_result = xmlrpcCall($command, $source);
   27   if ($rh_result) {
   28     if (defined($rh_result->{WARNINGS}) and $rh_result->{WARNINGS} ) {
   29         local(*FH);
   30       open(FH, ">>".LOG_FILE()) || die "Can't open log file ". LOG_FILE();
   31       print FH "$ARGV[0]\n";
   32       close(FH);
   33       print "$ARGV[0] has warnings\n";
   34     } else {
   35       print "$ARGV[0] is ok\n"; #problem is ok
   36     }
   37   } else {
   38     print 0;
   39   }
   40 
   41 
   42 } else {
   43     print "0\n";
   44   print STDERR "Useage: ./checkProblem.pl    [file_name]\n";
   45   print STDERR "For example: ./checkProblem.pl    input.txt\n";
   46 
   47 }

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9