[LON-CAPA-cvs] cvs: loncom /interface lonindexer.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 16 Jun 2003 22:09:02 -0000


albertel		Mon Jun 16 18:09:02 2003 EDT

  Modified files:              
    /loncom/interface	lonindexer.pm 
  Log:
  - BUG 1615, use scoping to force perl to frree the tie variable, so that the tie goes away.
     (At least it looks like it goes away now, and it remebers my last setup)
  
  
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.67 loncom/interface/lonindexer.pm:1.68
--- loncom/interface/lonindexer.pm:1.67	Mon Jun 16 13:27:33 2003
+++ loncom/interface/lonindexer.pm	Mon Jun 16 18:09:02 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.67 2003/06/16 17:27:33 matthew Exp $
+# $Id: lonindexer.pm,v 1.68 2003/06/16 22:09:02 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -126,13 +126,16 @@
     my $diropendb = 
 	"/home/httpd/perl/tmp/$ENV{'user.domain'}_$ENV{'user.name'}_indexer.db";
     %hash = ();
-    my %dbfile;
-    if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) {
-        while(my($key,$value)=each(%dbfile)) {
-            $hash{$key}=$value;
-        }
-        untie(%dbfile);
-
+    {
+	my %dbfile;
+	if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) {
+	    while(my($key,$value)=each(%dbfile)) {
+		$hash{$key}=$value;
+	    }
+	    untie(%dbfile);
+	}
+    }
+    {
 	if ($ENV{'form.launch'} eq '1') {
 	    &start_fresh_session();
         }
@@ -499,12 +502,13 @@
 
 # --------------------------------------------------- end the output and return
 	$r->print('</body></html>'."\n");
-    } else {
-	$r->print('<html><head></head><body>Unable to tie hash to db '.
-		  'file</body></html>');
-	return OK;
+#    } else {
+#	$r->print('<html><head></head><body>Unable to tie hash to db '.
+#		  'file</body></html>');
+#	return OK;
     }
     if(! $c->aborted()) {
+	my %dbfile;
         if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_NEWDB(),0640)) {
             while (my($key,$value) = each(%hash)) {
                 $dbfile{$key}=$value;