[LON-CAPA-cvs] cvs: modules /gerd/ct convert.pl

www lon-capa-cvs@mail.lon-capa.org
Thu, 22 Sep 2005 15:21:04 -0000


www		Thu Sep 22 11:21:04 2005 EDT

  Modified files:              
    /modules/gerd/ct	convert.pl 
  Log:
  Also generate meta file for dependencies
  
  
Index: modules/gerd/ct/convert.pl
diff -u modules/gerd/ct/convert.pl:1.6 modules/gerd/ct/convert.pl:1.7
--- modules/gerd/ct/convert.pl:1.6	Thu Sep 22 11:13:31 2005
+++ modules/gerd/ct/convert.pl	Thu Sep 22 11:21:01 2005
@@ -106,17 +106,6 @@
         open(OUT,">$path/cts$i.problem");
         print OUT $problem;
         close(OUT);
-        foreach my $url (@needtoget) {
-            unless ($url) { next; }
-            my ($relative)=($url=~/\/([^\/]+)$/);
-	    unless ($url=~/^http\:/) {
-		$url='http://www.deas.harvard.edu/galileo/images/ctimages/'.$url;
-	    }
-            system("cd $path; wget $url");
-            unless (-e "$path/$relative") {
-		print "\n\n----\nWarning: Could not get $path/$relative\n----\n\n";
-            }
-        }
 # produce the metafile
         my $meta='';
         my ($dummy,$dummy2,$copyid,$author,$email,$inst,$year)=split(/\,/,$CTCopyright[$i]);
@@ -142,6 +131,22 @@
         open(OUT,">$path/cts$i.problem.meta");
         print OUT $meta;
         close(OUT);
+# get the dependencies
+        foreach my $url (@needtoget) {
+            unless ($url) { next; }
+            my ($relative)=($url=~/\/([^\/]+)$/);
+	    unless ($url=~/^http\:/) {
+		$url='http://www.deas.harvard.edu/galileo/images/ctimages/'.$url;
+	    }
+            system("cd $path; wget $url");
+            unless (-e "$path/$relative") {
+		print "\n\n----\nWarning: Could not get $path/$relative\n----\n\n";
+            } else {
+		open(OUT,">$path/$relative.meta");
+		print OUT $meta;
+		close(OUT);
+	    }
+        }
     }
 }