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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 24 May 2002 18:55:23 -0000


albertel		Fri May 24 14:55:23 2002 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm 
  Log:
  - added a showhashsubset debugging function
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.78 loncom/homework/lonhomework.pm:1.79
--- loncom/homework/lonhomework.pm:1.78	Thu May 23 17:12:44 2002
+++ loncom/homework/lonhomework.pm	Fri May 24 14:55:23 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.78 2002/05/23 21:12:44 albertel Exp $
+# $Id: lonhomework.pm,v 1.79 2002/05/24 18:55:23 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -192,21 +192,29 @@
 
 sub showhash {
   my (%hash) = @_;
+  &showhashsubset(\%hash,'');
+  return '';
+}
+
+sub showhashsubset {
+  my ($hash,$keyre) = @_;
   my $resultkey;
-  foreach $resultkey (sort keys %hash) {
-    if (ref($hash{$resultkey})) {
-      if ($hash{$resultkey} =~ /ARRAY/ ) {
-	my $string="$resultkey ---- (";
-	foreach my $elm (@{ $hash{$resultkey} }) {
-	  $string.="$elm,";
+  foreach $resultkey (sort keys %$hash) {
+    if ($resultkey =~ /$keyre/) {
+      if (ref($$hash{$resultkey})) {
+	if ($$hash{$resultkey} =~ /ARRAY/ ) {
+	  my $string="$resultkey ---- (";
+	  foreach my $elm (@{ $$hash{$resultkey} }) {
+	    $string.="$elm,";
+	  }
+	  chop($string);
+	  &Apache::lonxml::debug("$string)");
+	} else {
+	  &Apache::lonxml::debug("$resultkey ---- $$hash{$resultkey}");
 	}
-	chop($string);
-	&Apache::lonxml::debug("$string)");
       } else {
-	&Apache::lonxml::debug("$resultkey ---- $hash{$resultkey}");
+	&Apache::lonxml::debug("$resultkey ---- $$hash{$resultkey}");
       }
-    } else {
-      &Apache::lonxml::debug("$resultkey ---- $hash{$resultkey}");
     }
   }
   &Apache::lonxml::debug("\n<br />restored values^</br>\n");
@@ -344,6 +352,7 @@
       #if ($Apache::lonhomework::viewgrades eq 'F') {&createmenu('grade',$request); }
     }
     #if ($target eq 'grade') { &showhash(%Apache::lonhomework::history); }
+    #if ($target eq 'web') { &showhash(%ENV); }
 
     my $default=&Apache::lonnet::getfile('/home/httpd/html/res/adm/includes/default_homework.lcpm');
     if ($default == -1) {