[LON-CAPA-cvs] cvs: loncom /homework structuretags.pm

raeburn raeburn at source.lon-capa.org
Mon Dec 15 13:44:20 EST 2014


raeburn		Mon Dec 15 18:44:20 2014 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  - Coding style:
   - keys(), split()
   - for readability eliminate use of $_
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.525 loncom/homework/structuretags.pm:1.526
--- loncom/homework/structuretags.pm:1.525	Fri Nov 28 18:23:04 2014
+++ loncom/homework/structuretags.pm	Mon Dec 15 18:44:20 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.525 2014/11/28 18:23:04 raeburn Exp $
+# $Id: structuretags.pm,v 1.526 2014/12/15 18:44:20 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -884,7 +884,7 @@
 	}
 	%Apache::lonhomework::history=
 	    &Apache::lonnet::tmprestore($namespace,'',$domain,$name);
-	my ($temp)=keys %Apache::lonhomework::history ;
+	my ($temp)=keys(%Apache::lonhomework::history) ;
 	&Apache::lonxml::debug("Return message of $temp");
     } else {
 	%Apache::lonhomework::history=
@@ -892,7 +892,7 @@
     }
 
     #ignore error conditions
-    my ($temp)=keys %Apache::lonhomework::history ;
+    my ($temp)=keys(%Apache::lonhomework::history);
     if ($temp =~ m/^error:.*/) { %Apache::lonhomework::history=(); }
 }
 
@@ -1166,7 +1166,7 @@
             }
         }
     }
-    if (keys (%aggregate) > 0) {
+    if (keys(%aggregate) > 0) {
 	&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
                             $cdomain,$cname);
     }
@@ -1617,7 +1617,7 @@
 	my $id = $Apache::inputtags::part;
 	my $weight = &Apache::lonnet::EXT("resource.$id.weight");
 	my $packages=&Apache::lonnet::metadata($env{'request.uri'},'packages');
-	my @packages = split /,/,$packages;
+	my @packages = split(/,/,$packages);
 	my $allow_print_points = 0;
 	foreach my $partial_key (@packages) {
 	    if ($partial_key=~m/^part_0$/) {
@@ -2351,8 +2351,8 @@
                     }
                 }
             }
-	    for(0 .. $show) {
-		$bodytext .= "$randomlist[ $idx_arr[$_] ]";
+	    for my $i (0 .. $show) {
+		$bodytext .= "$randomlist[ $idx_arr[$i] ]";
 	    }
 	    &Apache::lonxml::newparser($parser,\$bodytext);
 	}
@@ -2516,7 +2516,7 @@
 		    }
 		    my $weight = &Apache::lonnet::EXT("resource.$id.weight");
 		    my $allkeys=&Apache::lonnet::metadata($env{'request.uri'},'packages');
-		    my @allkeys = split /,/,$allkeys;
+		    my @allkeys = split(/,/,$allkeys);
 		    my $allow_print_points = 0;
 		    foreach my $partial_key (@allkeys) {
 			if ($partial_key=~m/^part_(.*)$/) {




More information about the LON-CAPA-cvs mailing list