[LON-CAPA-cvs] cvs: loncom / LondConnection.pm
foxr
lon-capa-cvs@mail.lon-capa.org
Tue, 28 Oct 2003 11:15:10 -0000
foxr Tue Oct 28 06:15:10 2003 EDT
Modified files:
/loncom LondConnection.pm
Log:
Added ReadForeignConfig for use outside the LonCAPA environment (e.g. in lonManage).
Index: loncom/LondConnection.pm
diff -u loncom/LondConnection.pm:1.14 loncom/LondConnection.pm:1.15
--- loncom/LondConnection.pm:1.14 Tue Oct 28 05:47:44 2003
+++ loncom/LondConnection.pm Tue Oct 28 06:15:10 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.14 2003/10/28 10:47:44 foxr Exp $
+# $Id: LondConnection.pm,v 1.15 2003/10/28 11:15:10 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -64,10 +64,33 @@
die "Can't read host table!!";
%hostshash = %{$hoststab};
- close(CONFIG);
}
+#
+# Read a foreign configuration.
+# This sub is intended for the cases where the package
+# will be read from outside the LonCAPA environment, in that case
+# the client will need to explicitly provide:
+# - A file in hosts.tab format.
+# - Some idea of the 'lonCAPA' name of the local host (for building
+# the encryption key).
+#
+# Parameters:
+# MyHost - Name of this host as far as LonCAPA is concerned.
+# Filename - Name of a hosts.tab formatted file that will be used
+# to build up the hosts table.
+#
+sub ReadForeignConfig {
+ my $MyHost = shift;
+ my $Filename = shift;
+
+ $perlvar{lonHostID} = $MyHost; # Rmember my host.
+ my $hosttab = read_hosts($Filename) ||
+ die "Can't read hosts table!!";
+ %hostshash = %{$hosttab}
+
+}
sub Debug {
my $level = shift;