Index: /gsdl/trunk/perllib/classify.pm
===================================================================
--- /gsdl/trunk/perllib/classify.pm	(revision 15701)
+++ /gsdl/trunk/perllib/classify.pm	(revision 15702)
@@ -42,5 +42,4 @@
 
 
-$next_classify_num = 1;
 $oid_to_clids = {};
 
@@ -295,34 +294,36 @@
 }
 
+
 # output_classify_info outputs all the info needed for the classification
-# to the gdbm
-sub output_classify_info {
-    my ($classifiers, $handle, $remove_empty_classifications, $gli) = @_;
-#    $handle = "main::STDOUT";
+# to the database
+sub output_classify_info
+{
+    my ($classifiers, $infodb_handle, $remove_empty_classifications, $gli) = @_;
 
     $gli = 0 unless defined $gli;
 
     # create a classification containing all the info
-    my $classifyinfo = {'classifyOID'=>'browse',
-			'contains'=>[]};
+    my $classifyinfo = { 'classifyOID'=> 'browse',
+			 'contains' => [] };
 
     # get each of the classifications
-    foreach $classobj (@$classifiers) {
-	my $tempinfo = $classobj->get_classify_info($gli);
-	my $classID = $tempinfo->{'classifyOID'};
-
-	$tempinfo->{'classifyOID'} = "CL$next_classify_num" unless defined($tempinfo->{'classifyOID'});
+    my $next_classify_num = 1;
+    foreach $classifier (@$classifiers)
+    {
+	my $classifier_info = $classifier->get_classify_info($gli);
+	$classifier_info->{'classifyOID'} = "CL$next_classify_num" unless defined($classifier_info->{'classifyOID'});
+        print STDERR "*** outputting information for classifier: $classifier_info->{'classifyOID'}\n";
+
+	push(@{$classifyinfo->{'contains'}}, $classifier_info);
 	$next_classify_num++;
-
-        print STDERR "*** outputting information for classifier: $tempinfo->{'classifyOID'}\n";
-
-	push (@{$classifyinfo->{'contains'}}, $tempinfo);
-    }
-
-    &print_classify_info ($handle, $classifyinfo, "", $remove_empty_classifications);
-}
-
-sub print_classify_info {
-    my ($handle, $classifyinfo, $OID, $remove_empty_classifications) = @_;
+    }
+
+    &print_classify_info ($infodb_handle, $classifyinfo, "", $remove_empty_classifications);
+}
+
+
+sub print_classify_info
+{
+    my ($infodb_handle, $classifyinfo, $OID, $remove_empty_classifications) = @_;
 
     $OID =~ s/^\.+//; # just for good luck
@@ -335,27 +336,27 @@
    
     $OID = $classifyinfo->{'classifyOID'} if defined ($classifyinfo->{'classifyOID'});
-	
-    my $outputtext = "[$OID]\n";
-    $outputtext .= "<doctype>classify\n";
-    $outputtext .= "<hastxt>0\n";
-    $outputtext .= "<childtype>$classifyinfo->{'childtype'}\n" 
+
+    my %classify_infodb = ();
+    $classify_infodb{"doctype"} = [ "classify" ];
+    $classify_infodb{"hastxt"} = [ "0" ];
+    $classify_infodb{"childtype"} = [ $classifyinfo->{'childtype'} ]
 	if defined $classifyinfo->{'childtype'};
-    $outputtext .= "<Title>$classifyinfo->{'Title'}\n" 
+    $classify_infodb{"Title"} = [ $classifyinfo->{'Title'} ]
 	if defined $classifyinfo->{'Title'};
-    $outputtext .= "<numleafdocs>$classifyinfo->{'numleafdocs'}\n" 
+    $classify_infodb{"numleafdocs"} = [ $classifyinfo->{'numleafdocs'} ]
 	if defined $classifyinfo->{'numleafdocs'};
-    $outputtext .= "<thistype>$classifyinfo->{'thistype'}\n" 
+    $classify_infodb{"thistype"} = [ $classifyinfo->{'thistype'} ]
 	if defined $classifyinfo->{'thistype'};
-    $outputtext .= "<parameters>$classifyinfo->{'parameters'}\n" 
+    $classify_infodb{"parameters"} = [ $classifyinfo->{'parameters'} ]
 	if defined $classifyinfo->{'parameters'};
-    $outputtext .= "<supportsmemberof>$classifyinfo->{'supportsmemberof'}\n"
+    $classify_infodb{"supportsmemberof"} = [ $classifyinfo->{'supportsmemberof'} ]
 	if defined $classifyinfo->{'supportsmemberof'};
     
-    my $contains_text = "<contains>";
-    my $mdoffset_text = "<mdoffset>";
+    my $contains_text = "";
+    my $mdoffset_text = "";
     
     my $next_subOID = 1;
     my $first = 1;
-    foreach $tempinfo (@{$classifyinfo->{'contains'}}) {
+    foreach my $tempinfo (@{$classifyinfo->{'contains'}}) {
 	# empty contents were made undefined by clean_contents()
 	next unless defined $tempinfo;
@@ -386,5 +387,5 @@
             #rint STDERR "Result: \"" . join(";", @{$clids}) . "\"\n";
             
-	    &print_classify_info ($handle, $tempinfo, $tempinfo->{'classifyOID'},
+	    &print_classify_info ($infodb_handle, $tempinfo, $tempinfo->{'classifyOID'},
 				  $remove_empty_classifications);
 	} elsif (defined ($tempinfo->{'OID'})) {
@@ -431,5 +432,5 @@
                 #rint STDERR "Result: \"" . join(";", @{$clids}) . "\"\n";
 		
-		&print_classify_info ($handle, $tempinfo, "$OID.$next_subOID",
+		&print_classify_info ($infodb_handle, $tempinfo, "$OID.$next_subOID",
 				      $remove_empty_classifications);
 		$next_subOID++;
@@ -437,15 +438,13 @@
     }
     
-    $outputtext .= "$contains_text\n";
-    $outputtext .= "<mdtype>$classifyinfo->{'mdtype'}\n" 
+    $classify_infodb{"contains"} = [ $contains_text ];
+    $classify_infodb{"mdtype"} = [ $classifyinfo->{'mdtype'} ]
 	if defined $classifyinfo->{'mdtype'};
-    $outputtext .= "$mdoffset_text\n"
-	if ($mdoffset_text !~ m/^<mdoffset>;+$/);
-    
-    $outputtext .= '-' x 70 . "\n";
-    
-    print $handle $outputtext;
-
-}
+    $classify_infodb{"mdoffset"} = [ $mdoffset_text ]
+	if ($mdoffset_text !~ m/^;+$/);
+    
+    &dbutil::write_infodb_entry($infodb_handle, $OID, \%classify_infodb);
+}
+
 
 sub check_contents {
