[LON-CAPA-cvs] cvs: loncom / LondConnection.pm

foxr lon-capa-cvs@mail.lon-capa.org
Tue, 07 Oct 2003 11:23:26 -0000


foxr		Tue Oct  7 07:23:26 2003 EDT

  Modified files:              
    /loncom	LondConnection.pm 
  Log:
  Move configuration read into a sub so that it can be called again on reinits.
  
  
  
Index: loncom/LondConnection.pm
diff -u loncom/LondConnection.pm:1.11 loncom/LondConnection.pm:1.12
--- loncom/LondConnection.pm:1.11	Tue Sep 30 06:46:57 2003
+++ loncom/LondConnection.pm	Tue Oct  7 07:23:26 2003
@@ -1,7 +1,7 @@
 #   This module defines and implements a class that represents
 #   a connection to a lond daemon.
 #
-# $Id: LondConnection.pm,v 1.11 2003/09/30 10:46:57 foxr Exp $
+# $Id: LondConnection.pm,v 1.12 2003/10/07 11:23:26 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -38,20 +38,30 @@
 use LONCAPA::Configuration;
 use LONCAPA::HashIterator;
 
+
+
+
 my $DebugLevel=0;
+my %hostshash;
+my %perlvar;
 
 #   Read the configuration file for apache to get the perl
 #   variable set.
 
-my $perlvarref = LONCAPA::Configuration::read_conf('loncapa.conf');
-my %perlvar    = %{$perlvarref};
-my $hoststab   = 
-    LONCAPA::Configuration::read_hosts(
-            "$perlvar{'lonTabDir'}/hosts.tab") || 
-    die "Can't read host table!!";
-my %hostshash  = %{$hoststab};
+sub ReadConfig {
+    my $perlvarref = LONCAPA::Configuration::read_conf('loncapa.conf');
+    %perlvar    = %{$perlvarref};
+    my $hoststab   = 
+	LONCAPA::Configuration::read_hosts(
+					   "$perlvar{'lonTabDir'}/hosts.tab") || 
+					   die "Can't read host table!!";
+    %hostshash  = %{$hoststab};
+    
+    close(CONFIG);
+}
+
 
-close(CONFIG);
+ReadConfig;			# Make sure it gets read on init.
 
 sub Debug {
     my $level   = shift;
@@ -65,7 +75,7 @@
 
 =head2 Dump
 
-Dump the internal state of the object: For debugging purposes.
+Dump the internal state of the object: For debugging purposes, to stderr.
 
 =cut
 
@@ -75,7 +85,7 @@
     my $value;
     print "Dumping LondConnectionObject:\n";
     while(($key, $value) = each %$self) {
-	print "$key -> $value\n";
+	print STDERR "$key -> $value\n";
     }
     print "-------------------------------\n";
 }