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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 16 Oct 2006 19:39:57 -0000


albertel		Mon Oct 16 15:39:57 2006 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - style
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.792 loncom/lonnet/perl/lonnet.pm:1.793
--- loncom/lonnet/perl/lonnet.pm:1.792	Mon Oct 16 15:18:15 2006
+++ loncom/lonnet/perl/lonnet.pm	Mon Oct 16 15:39:57 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.792 2006/10/16 19:18:15 raeburn Exp $
+# $Id: lonnet.pm,v 1.793 2006/10/16 19:39:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4217,13 +4217,14 @@
 }
 
 sub auto_instcode_format {
-    my ($caller,$codedom,$instcodes,$codes,$codetitles,$cat_titles,$cat_order) = @_;
+    my ($caller,$codedom,$instcodes,$codes,$codetitles,$cat_titles,
+	$cat_order) = @_;
     my $courses = '';
     my @homeservers;
     if ($caller eq 'global') {
-        foreach my $tryserver (keys %libserv) {
+        foreach my $tryserver (keys(%libserv)) {
             if ($hostdom{$tryserver} eq $codedom) {
-                if (!grep/^\Q$tryserver\E$/,@homeservers) {
+                if (!grep(/^\Q$tryserver\E$/,@homeservers)) {
                     push(@homeservers,$tryserver);
                 }
             }
@@ -4231,8 +4232,8 @@
     } else {
         push(@homeservers,&homeserver($caller,$codedom));
     }
-    foreach (keys %{$instcodes}) {
-        $courses .= &escape($_).'='.&escape($$instcodes{$_}).'&';
+    foreach my $code (keys(%{$instcodes})) {
+        $courses .= &escape($code).'='.&escape($$instcodes{$code}).'&';
     }
     chop($courses);
     my $ok_response = 0;
@@ -4242,7 +4243,7 @@
         $response=&reply('autoinstcodeformat:'.$codedom.':'.$courses,$server);
         if ($response !~ /(con_lost|error|no_such_host|refused)/) {
             my ($codes_str,$codetitles_str,$cat_titles_str,$cat_order_str) = 
-                                                            split/:/,$response;
+		split/:/,$response;
             %{$codes} = (%{$codes},&str2hash($codes_str));
             push(@{$codetitles},&str2array($codetitles_str));
             %{$cat_titles} = (%{$cat_titles},&str2hash($cat_titles_str));
@@ -4260,9 +4261,9 @@
 sub auto_instcode_defaults {
     my ($domain,$returnhash,$code_order) = @_;
     my @homeservers;
-    foreach my $tryserver (keys %libserv) {
+    foreach my $tryserver (keys(%libserv)) {
         if ($hostdom{$tryserver} eq $domain) {
-            if (!grep/^\Q$tryserver\E$/,@homeservers) {
+            if (!grep(/^\Q$tryserver\E$/,@homeservers)) {
                 push(@homeservers,$tryserver);
             }
         }
@@ -4273,10 +4274,10 @@
         my $server = shift(@homeservers);
         $response=&reply('autoinstcodedefaults:'.$domain,$server);
         if ($response !~ /(con_lost|error|no_such_host|refused)/) {
-            foreach (split(/\&/,$response)) {
-                my ($name,$value)=split(/\=/,$_);
+            foreach my $pair (split(/\&/,$response)) {
+                my ($name,$value)=split(/\=/,$pair);
                 if ($name eq 'code_order') {
-                    @{$code_order} = split(/\&/,&unescape($value));
+                    $code_order = [split(/\&/,&unescape($value))];
                 } else {
                     $$returnhash{&unescape($name)}=&unescape($value);
                 }