Perl Assignment

Grading Programming Assignments

Due: 10 March, by email


Tas find grading to be an onerous task. Having to copy, compile and then run each individual program by hand is rather tedious. Much of this work can be scripted. In this assignment, you will write scripts to copy, compile, run, and capture output from student assignments.


Problem:

Your students have handed in their programming assignments. These are located in a handin directory which is not in your home directory. In other words, compiling and running in this location is not an option. You need to compile and run each of these programs. And you want to capture the output of the program in a large ouput file that you can examine later for correctness.


What You Will Do:

Write a Perl script that will copy, compile, and run student programs. All of the files will be located in the same handin directory, under the student login and assignment number (eg: handin/brown/A2). The script will first copy all of the files into a location in your home directory. This location should mimic the structure of the handin directory. Each program will be named A2.cxx.

Next, you will compile all of the programs. These are C++ programs, so compile using g++.

Finally, you will run each program, specifying an input filename on the command line. I will provide you with an input file. Print the results of each program to a master file, that you can save and examine later for correctness.

You will need to distinguish one student's work from another. So, before the results of each program are printed, insert a line that says


Student Name BROWN (or WHITEMAN, etc)


Remember that students have a snarky habit of handing in programs that don't work...or even don't compile. Your script should handle this.


What You Will Use:

This assignment will give you practice with: file I/O, reading directories, regexes, command line options, and shell execution. You will use the command line to specify four things: (a) which directory contains the program files to be processed (ex: /u/w/h/whiteman/public/perl/handin), (b) the assignment (A2), (c) the input file, and (d) the output file to be produced. The directory will be specified using a -dir switch, the assignment by a -assign switch, the input file by a -if switch and the output file by a -of switch.


Additional Details:

The student programs will be located in: ~whiteman/public/perl/assign/handin. They are available NOW. The input file is located in ~whiteman/public/perl/assign.

Turn in on or before 10 March 2003 to whiteman@cs.wisc.edu


Questions? Email me, hit office hours, and check out Learning Perl or the Camel book.