[LON-CAPA-cvs] cvs: loncom /interface lonsearchcourse.pm
raeburn
raeburn at source.lon-capa.org
Sun Feb 11 18:03:13 EST 2024
raeburn Sun Feb 11 23:03:13 2024 EDT
Modified files:
/loncom/interface lonsearchcourse.pm
Log:
- Coding style -- eliminate $_ .
Index: loncom/interface/lonsearchcourse.pm
diff -u loncom/interface/lonsearchcourse.pm:1.11 loncom/interface/lonsearchcourse.pm:1.12
--- loncom/interface/lonsearchcourse.pm:1.11 Sun Feb 11 22:20:06 2024
+++ loncom/interface/lonsearchcourse.pm Sun Feb 11 23:03:13 2024
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Course
#
-# $Id: lonsearchcourse.pm,v 1.11 2024/02/11 22:20:06 raeburn Exp $
+# $Id: lonsearchcourse.pm,v 1.12 2024/02/11 23:03:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -138,9 +138,9 @@
my $c=$r->connection;
if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.".db",
&GDBM_READER(),0640)) {
- foreach (sort(keys(%hash))) {
- if ($c->aborted()) { last; }
- if (($_=~/^src\_(.+)$/)) {
+ foreach my $key (sort(keys(%hash))) {
+ last if ($c->aborted());
+ if ($key =~ /^src\_(.+)$/) {
my $rid = $1;
unless ($env{'request.role.adv'}) {
next if ($hash{'randomout_'.$rid} || $hash{'deeplinkout_'.$rid});
@@ -152,7 +152,7 @@
}
}
my $symb=&make_symb($1);
- &checkonthis($r,$1,$hash{$_},0,&Apache::lonnet::gettitle($symb),
+ &checkonthis($r,$1,$hash{$key},0,&Apache::lonnet::gettitle($symb),
$fulltext,$symb,$target, at allwords);
}
}
@@ -296,18 +296,18 @@
# 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,'',$fulltext,undef,$target, at allwords);
+ foreach my $url (split(/\,/,$dependencies)) {
+ if (($url =~ /^\/res\//) && (!$alreadyseen{$id})) {
+ &checkonthis($r,$id,$url,$level+1,'',$fulltext,undef,$target, at allwords);
}
}
}
sub checkwords {
my ($result,$applies, at allwords) = @_;
- foreach (@allwords) {
- if ($_=~/\w/) {
- if ($result=~/$_/si) {
+ foreach my $word (@allwords) {
+ if ($word =~ /\w/) {
+ if ($result =~ /$word/si) {
$applies++;
}
}
More information about the LON-CAPA-cvs
mailing list