[LON-CAPA-cvs] cvs: loncom /metadata_database searchcat.pl
www
lon-capa-cvs@mail.lon-capa.org
Wed, 08 Oct 2003 14:15:03 -0000
www Wed Oct 8 10:15:03 2003 EDT
Modified files:
/loncom/metadata_database searchcat.pl
Log:
Not yet sufficiently tested: reduce memory consumption of searchcat.pl by
replacing foreach with while.
Index: loncom/metadata_database/searchcat.pl
diff -u loncom/metadata_database/searchcat.pl:1.41 loncom/metadata_database/searchcat.pl:1.42
--- loncom/metadata_database/searchcat.pl:1.41 Tue Oct 7 13:51:38 2003
+++ loncom/metadata_database/searchcat.pl Wed Oct 8 10:15:03 2003
@@ -2,7 +2,7 @@
# The LearningOnline Network
# searchcat.pl "Search Catalog" batch script
#
-# $Id: searchcat.pl,v 1.41 2003/10/07 17:51:38 www Exp $
+# $Id: searchcat.pl,v 1.42 2003/10/08 14:15:03 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -154,8 +154,8 @@
my $regexp=$url;
$regexp=~s/(\W)/\\$1/g;
$regexp='___'.$regexp.'___([a-z]+)$';
- foreach (keys %evaldata) {
- my $key=&unescape($_);
+ while (my ($key,$value)=each %evaldata) {
+ $key=&unescape($key);
if ($key=~/$regexp/) {
my $ctype=$1;
if (defined($cnt{$ctype})) {
@@ -165,21 +165,21 @@
}
unless ($listitems{$ctype} eq 'app') {
if (defined($sum{$ctype})) {
- $sum{$ctype}+=$evaldata{$_};
+ $sum{$ctype}+=$value;
} else {
- $sum{$ctype}=$evaldata{$_};
+ $sum{$ctype}=$value;
}
} else {
if (defined($sum{$ctype})) {
- if ($evaldata{$_}) {
- $sum{$ctype}.='<hr>'.$evaldata{$_};
+ if ($value) {
+ $sum{$ctype}.='<hr>'.$value;
}
} else {
- $sum{$ctype}=''.$evaldata{$_};
+ $sum{$ctype}=''.$value;
}
}
if ($ctype ne 'count') {
- $newevaldata{$_}=$evaldata{$_};
+ $newevaldata{$_}=$value;
}
}
}