[LON-CAPA-cvs] cvs: loncom /interface lonindexcourse.pm

raeburn raeburn at source.lon-capa.org
Sun Feb 11 22:46:17 EST 2024


raeburn		Mon Feb 12 03:46:17 2024 EDT

  Modified files:              
    /loncom/interface	lonindexcourse.pm 
  Log:
  - Coding style -- eliminate $_ .
  
  
Index: loncom/interface/lonindexcourse.pm
diff -u loncom/interface/lonindexcourse.pm:1.2 loncom/interface/lonindexcourse.pm:1.3
--- loncom/interface/lonindexcourse.pm:1.2	Sun Dec 25 20:41:53 2011
+++ loncom/interface/lonindexcourse.pm	Mon Feb 12 03:46:17 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Index Course
 #
-# $Id: lonindexcourse.pm,v 1.2 2011/12/25 20:41:53 raeburn Exp $
+# $Id: lonindexcourse.pm,v 1.3 2024/02/12 03:46:17 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -70,14 +70,15 @@
     %alreadyseen=();
     if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.".db",
             &GDBM_READER(),0640)) {
-        foreach (sort(keys(%hash))) {
-            if ($c->aborted()) { last; }
-            if (($_=~/^src\_(.+)$/)) {
-                if ($hash{'randomout_'.$1} & !$env{'request.role.adv'}) {
+        foreach my $key (sort(keys(%hash))) {
+            last if ($c->aborted());
+            if ($key =~ /^src\_(.+)$/) {
+                my $rid = $1;
+                if ($hash{'randomout_'.$rid} & !$env{'request.role.adv'}) {
                     next;
                 }
-                my $symb=&make_symb($1);
-                my %newwords=&checkonthis($r,$1,$hash{$_},0,&Apache::lonnet::gettitle($symb),
+                my $symb=&make_symb($rid);
+                my %newwords=&checkonthis($r,$rid,$hash{$key},0,&Apache::lonnet::gettitle($symb),
                              $symb);
             }
         }
@@ -136,9 +137,9 @@
 # Check also the dependencies of this one
     my $dependencies=
                 &Apache::lonnet::metadata($url,'dependencies');
-    foreach (split(/\,/,$dependencies)) {
-       if (($_=~/^\/res\//) && (!$alreadyseen{$id})) {
-          &checkonthis($r,$id,$_,$level+1,'');
+    foreach my $item (split(/\,/,$dependencies)) {
+       if (($item =~ /^\/res\//) && (!$alreadyseen{$id})) {
+          &checkonthis($r,$id,$item,$level+1,'');
        }
     }
 }




More information about the LON-CAPA-cvs mailing list