[LON-CAPA-cvs] cvs: loncom /configuration Configuration.pm

foxr lon-capa-cvs@mail.lon-capa.org
Sat, 12 Apr 2003 02:45:32 -0000


foxr		Fri Apr 11 22:45:32 2003 EDT

  Modified files:              
    /loncom/configuration	Configuration.pm 
  Log:
  In read_hosts: detect and ignore 'malformed' lines that fit the following
  descriptions:
  -  # as first non-whitespace character (comment).
  -  Too few elements to make a valid host def (probably blank line).
  
  
  
Index: loncom/configuration/Configuration.pm
diff -u loncom/configuration/Configuration.pm:1.9 loncom/configuration/Configuration.pm:1.10
--- loncom/configuration/Configuration.pm:1.9	Tue Apr  8 20:52:37 2003
+++ loncom/configuration/Configuration.pm	Fri Apr 11 22:45:31 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Configuration file reader
 #
-# $Id: Configuration.pm,v 1.9 2003/04/09 00:52:37 foxr Exp $
+# $Id: Configuration.pm,v 1.10 2003/04/12 02:45:31 foxr Exp $
 #
 #
 # Copyright Michigan State University Board of Trustees
@@ -34,7 +34,7 @@
 
 package LONCAPA::Configuration;
 
-$VERSION = sprintf("%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/);
+$VERSION = sprintf("%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/);
 
 use strict;
 
@@ -79,20 +79,24 @@
     
     open(CONFIG,'<'.$Filename) or die("Can't read $Filename");
     while (my $line = <CONFIG>) {
-	my @items = split(/:/, $line);
-	if (scalar @items == $RequiredCount) {	# Have only all required items:
-	    $items[$RequiredCount] = $DefaultMaxCon;
-	}
-	if(scalar @items == $RequiredCount + 1) { # Have up through maxcon.
-	    $items[$RequiredCount+1] = $DefaultIdle;
-	}
-	if(scalar @items == $RequiredCount + 2) { # Have up through idle.
-	    $items[$RequiredCount+2] = $DefaultMinCon;
-	}
-	{
-	    my @list = @items;	# probably not needed but I'm unsure of 
-				# about the scope of item so...
-	    $HostsTab{@list[0]} = \@list; 
+	if (!($line =~ /^\s*\#/)) {
+	    my @items = split(/:/, $line);
+	    if(scalar @items >= $RequiredCount) {
+		if (scalar @items == $RequiredCount) { # Only required items:
+		    $items[$RequiredCount] = $DefaultMaxCon;
+		}
+		if(scalar @items == $RequiredCount + 1) { # up through maxcon.
+		    $items[$RequiredCount+1] = $DefaultIdle;
+		}
+		if(scalar @items == $RequiredCount + 2) { # up through idle.
+		    $items[$RequiredCount+2] = $DefaultMinCon;
+		}
+		{
+		    my @list = @items; # probably not needed but I'm unsure of 
+		    # about the scope of item so...
+		    $HostsTab{@list[0]} = \@list; 
+		}
+	    }
 	}
     }
     close(CONFIG);