[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Wed, 20 Dec 2006 23:25:15 -0000
raeburn Wed Dec 20 18:25:15 2006 EDT
Modified files:
/loncom/interface lonnavmaps.pm
Log:
Eliminating $_
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.393 loncom/interface/lonnavmaps.pm:1.394
--- loncom/interface/lonnavmaps.pm:1.393 Wed Dec 20 18:02:33 2006
+++ loncom/interface/lonnavmaps.pm Wed Dec 20 18:25:13 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.393 2006/12/20 23:02:33 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.394 2006/12/20 23:25:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -149,7 +149,7 @@
if (defined($res)) {
my $anchor;
if ($res->is_page()) {
- foreach (@$stack) { if (defined($_)) { $anchor = $_; } }
+ foreach my $item (@$stack) { if (defined($item)) { $anchor = $item; } }
$anchor=&escape($anchor->shown_symb());
return ($res->link(),$res->shown_symb(),$anchor);
}
@@ -167,8 +167,8 @@
# (when we first recurse on a map, it puts an undefined resource
# on the bottom because $self->{HERE} isn't defined yet, and we
# want the src for the map anyhow)
- foreach (@$stack) {
- if (defined($_)) { $res = $_; }
+ foreach my $item (@$stack) {
+ if (defined($item)) { $res = $item; }
}
return ($res->link(),$res->shown_symb());
@@ -904,10 +904,10 @@
if ($resource->getFeedback()) {
my $feedback = $resource->getFeedback();
- foreach (split(/\,/, $feedback)) {
- if ($_) {
+ foreach my $msgid (split(/\,/, $feedback)) {
+ if ($msgid) {
$feedbackHTML .= ' <a '.$target.' href="/adm/email?display='
- . &escape($_) . '">'
+ . &escape($msgid) . '">'
. '<img alt="'.&mt('New Email').'" src="'.$location.'/feedback.gif" '
. 'border="0" /></a>';
}
@@ -917,12 +917,12 @@
if ($resource->getErrors()) {
my $errors = $resource->getErrors();
my $errorcount = 0;
- foreach (split(/,/, $errors)) {
+ foreach my $msgid (split(/,/, $errors)) {
last if ($errorcount>=10); # Only output 10 bombs maximum
- if ($_) {
+ if ($msgid) {
$errorcount++;
$errorHTML .= ' <a '.$target.' href="/adm/email?display='
- . &escape($_) . '">'
+ . &escape($msgid) . '">'
. '<img alt="'.&mt('New Error').'" src="'.$location.'/bomb.gif" '
. 'border="0" /></a>';
}
@@ -1126,9 +1126,9 @@
# marker
my $filterHash = {};
# Figure out what we're not displaying
- foreach (split(/\,/, $env{"form.filter"})) {
- if ($_) {
- $filterHash->{$_} = "1";
+ foreach my $item (split(/\,/, $env{"form.filter"})) {
+ if ($item) {
+ $filterHash->{$item} = "1";
}
}
@@ -1901,10 +1901,10 @@
my %lastread = &Apache::lonnet::dump('nohist_'.$cid.'_discuss',
$env{'user.domain'},$env{'user.name'},'lastread');
my %lastreadtime = ();
- foreach (keys %lastread) {
- my $key = $_;
- $key =~ s/_lastread$//;
- $lastreadtime{$key} = $lastread{$_};
+ foreach my $key (keys %lastread) {
+ my $shortkey = $key;
+ $shortkey =~ s/_lastread$//;
+ $lastreadtime{$shortkey} = $lastread{$key};
}
my %feedback=();
@@ -3122,9 +3122,9 @@
# filter the next possibilities to remove things we've
# already seen.
- foreach (@$nextUnfiltered) {
- if (!defined($self->{ALREADY_SEEN}->{$_->{ID}})) {
- push @$next, $_;
+ foreach my $item (@$nextUnfiltered) {
+ if (!defined($self->{ALREADY_SEEN}->{$item->{ID}})) {
+ push @$next, $item;
}
}
@@ -3857,8 +3857,8 @@
email data was not extracted when the nav map was constructed. Usually
used like this:
- for (split(/\,/, $res->getFeedback())) {
- my $link = &escape($_);
+ for my $url (split(/\,/, $res->getFeedback())) {
+ my $link = &escape($url);
...
and use the link as appropriate.
@@ -4052,8 +4052,8 @@
$self->{PART_TYPE} = {};
return;
}
- foreach (split(/\,/,$metadata)) {
- if ($_ =~ /^(?:part|Task)_(.*)$/) {
+ foreach my $entry (split(/\,/,$metadata)) {
+ if ($entry =~ /^(?:part|Task)_(.*)$/) {
my $part = $1;
# This floods the logs if it blows up
if (defined($parts{$part})) {
@@ -4078,8 +4078,8 @@
# Init the responseIdHash
- foreach (@{$self->{PARTS}}) {
- $responseIdHash{$_} = [];
+ foreach my $part (@{$self->{PARTS}}) {
+ $responseIdHash{$part} = [];
}
# Now, the unfortunate thing about this is that parts, part name, and
@@ -4159,13 +4159,13 @@
Idiomatic usage of these two methods would probably look something
like
- foreach ($resource->parts()) {
- my $dateStatus = $resource->getDateStatus($_);
- my $completionStatus = $resource->getCompletionStatus($_);
+ foreach my $part ($resource->parts()) {
+ my $dateStatus = $resource->getDateStatus($part);
+ my $completionStatus = $resource->getCompletionStatus($part);
or
- my $status = $resource->status($_);
+ my $status = $resource->status($part);
... use it here ...
}