Parent Directory
|
Revision Log
development version dev-1-7-01 from /ww/webwork/development 15-June-2001
1 #!/usr/local/bin/perl 2 3 ## $Id$ 4 5 # This file is dumpDatabase.pl 6 # Call with command arguments of the form: classID 7 # This file loads the database from the class list and the set definition 8 # copyright 1996 WeBWorK All rights reserved. 9 ################################################################### 10 11 use lib '/ww/webwork/gage_system/webwork/system/lib/'; # mainWeBWorKDirectory 12 use Global; 13 14 15 # Check that this program was called with two arguments 16 if (@ARGV != 1) 17 { print "syntax: dumpDatabase.pl classID >myfile.html\n"; 18 exit (0); 19 } 20 else { 21 $classID = $ARGV[0]; 22 } 23 24 $scriptDirectory = $Global::scriptDirectory; 25 &Global::getCourseEnvironment("$classID"); 26 $databaseDirectory = $Global::databaseDirectory; 27 28 require "${scriptDirectory}$Global::DBglue_pl"; 29 # Dump the contents of the DBM files: 30 31 # Get database 32 &attachDBMpin(); 33 34 # Print the hash array 35 36 37 print "The contents of the $classID database at $databaseDirectory:\n\n\n"; 38 print &hash2html("Contents of database array:",%PROBSET); 39 print STDOUT "\n\nOutput sent to STDOUT.\n\n"; 40 41 42 &detachDBMpin(); 43 exit(0); 44 45 46 47 48 49 50 sub hash2html { 51 $title=shift(@_); 52 %hash=@_; 53 54 55 $out= "<DL>$title\n"; 56 57 @keys=keys(%hash); 58 foreach $key (sort @keys) 59 { 60 $out .= "\t<DT>$key</DT>\n"; 61 $out .= "\t\t<DD>$hash{$key}</DD>\n"; 62 } 63 64 $out .= "</DL>\n"; 65 } 66 67 68 sub array2html { 69 $title=shift(@_); 70 @array=@_; 71 $out="<p>\n$title\n<OL>\n"; 72 foreach $entry (@array) { 73 $out .= "\t<LI>$entry</LI>\n"; 74 } 75 $out .= "</OL>\n"; 76 } 77
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |