Parent Directory
|
Revision Log
Removed unneeded scripts (as per discussion with gage, apizer). Added BEGIN-block method for library inclusion to command-line scripts.
1 #!/usr/local/bin/webwork-perl 2 3 4 BEGIN { 5 my $useLibDir = '.'; 6 if ($0 =~ m|^(/.*)/|) { $useLibDir = $1; } 7 elsif ($0 =~ m|^(\..*)/|) { $useLibDir = $1; } 8 elsif ($0 =~ m|^(.+)/|) { $useLibDir = "./$1"; } 9 unshift @INC, $useLibDir; 10 } 11 12 use webworkInit; # WeBWorKInitLine 13 14 use Global; 15 use Auth; 16 use strict; 17 18 if (@ARGV != 2) 19 { 20 print "\nSyntax is export_permission-database.pl courseID outputTextFile\n"; 21 print " (e.g. export_permission-database.pl demoCourse textDatabase)\n\n"; 22 exit(0); 23 } 24 25 my $course = $ARGV[0]; 26 my $outFileName = $ARGV[1]; 27 28 # establish environment for this script 29 30 &Global::getCourseEnvironment($course); 31 32 # File names 33 34 my $perm_file = &Global::getCoursePermissionsFile($course); 35 36 my %perm_hash; 37 my $perm_obj; 38 39 &Global::tie_hash('PERM_FILE',\$perm_obj,\%perm_hash, $perm_file,'R',$Global::standard_tie_permission); 40 41 my ($key,$item); 42 my @keys = sort keys %perm_hash; 43 44 open(OUTFILE,">$outFileName") or wwerror("$0","can't open $outFileName for writing"); 45 46 foreach $key (@keys) { 47 print OUTFILE "[$key]\n"; 48 print OUTFILE "\t$perm_hash{$key}\n"; 49 } 50 51 close(OUTFILE); 52 &Global::untie_hash('PERM_FILE',\$perm_obj,\%perm_hash, $perm_file);
aubreyja at gmail dot com | ViewVC Help |
Powered by ViewVC 1.0.9 |