[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 4733 - (download) (as text) (annotate)
Mon Jan 1 16:20:16 2007 UTC (6 years, 4 months ago) by gage
File size: 1115 byte(s)
Cleaned up code, updated README.
There is still much code that needs to be factored.
Merged changes in webwork_xmlrpc_client2.pl into webwork_xmlrp_client.pl
and removed the first file.

-- Mike

    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 
   17 use constant LOG_FILE => '/Volumes/Riemann/webwork/problemLibraries/bad_problems.txt';
   18 use XMLRPC::Lite;
   19 use MIME::Base64 qw( encode_base64 decode_base64);
   20 require "webwork_xmlrpc_inc.pl"; # must be in the same directory
   21 
   22 our $source = '';
   23 
   24 if (@ARGV) {
   25     $source = (defined $ARGV[0]) ? `cat $ARGV[0]` : '' ;
   26     my $command = 'renderProblem';
   27   my $rh_result = xmlrpcCall($command, $source);
   28   if ($rh_result) {
   29     if (defined($rh_result->{WARNINGS}) and $rh_result->{WARNINGS} ) {
   30         local(*FH);
   31       open(FH, ">>".LOG_FILE()) || die "Can't open log file ". LOG_FILE();
   32       print FH "$ARGV[0]\n";
   33       close(FH);
   34       print "$ARGV[0] has warnings\n";
   35     } else {
   36       print "$ARGV[0] is ok\n"; #problem is ok
   37     }
   38   } else {
   39     print 0;
   40   }
   41 
   42 
   43 } else {
   44     print "0\n";
   45   print STDERR "Useage: ./checkProblem.pl    [file_name]\n";
   46   print STDERR "For example: ./checkProblem.pl    input.txt\n";
   47 
   48 }

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9