[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

www lon-capa-cvs@mail.lon-capa.org
Tue, 01 Nov 2005 15:07:30 -0000


www		Tue Nov  1 10:07:30 2005 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Better spread out new course IDs so they don't all pile up in the same directory.
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.673 loncom/lonnet/perl/lonnet.pm:1.674
--- loncom/lonnet/perl/lonnet.pm:1.673	Mon Oct 31 14:32:19 2005
+++ loncom/lonnet/perl/lonnet.pm	Tue Nov  1 10:07:29 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.673 2005/10/31 19:32:19 albertel Exp $
+# $Id: lonnet.pm,v 1.674 2005/11/01 15:07:29 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3974,7 +3974,9 @@
         return 'refused';
     }
 # ------------------------------------------------------------------- Create ID
-   my $uname=substr($$.time,0,5).unpack("H8",pack("I32",time)).
+   my $uname=int(1+rand(9)).
+       ('a'..'z','A'..'Z','0'..'9')[int(rand(62))].
+       substr($$.time,0,5).unpack("H8",pack("I32",time)).
        unpack("H2",pack("I32",int(rand(255)))).$perlvar{'lonHostID'};
 # ----------------------------------------------- Make sure that does not exist
    my $uhome=&homeserver($uname,$udom,'true');