Index: trunk/gsdl/perllib/classify/GenericList.pm
===================================================================
--- trunk/gsdl/perllib/classify/GenericList.pm	(revision 12888)
+++ trunk/gsdl/perllib/classify/GenericList.pm	(revision 12889)
@@ -37,5 +37,4 @@
 
 use strict;
-no strict 'refs';  # Allow filehandles to be variables and viceversa
 
 
@@ -50,4 +49,5 @@
 	'type' => "metadata",
 	'reqd' => "yes" },
+
       # The interesting options
       { 'name' => "always_bookshelf_last_level",
@@ -89,5 +89,5 @@
 
     my $self = (defined $hashArgOptLists) ? new BasClas($classifierslist, $inputargs, $hashArgOptLists) : new BasClas($classifierslist, $inputargs);
-    $self->{'OIDlist'} = [];
+    $self->{'OIDs'} = [];
 
     if ($self->{'info_only'}) {
@@ -108,11 +108,11 @@
 	die "Error: No metadata fields specified for GenericList.\n";
     }
-    my @metalist = split(/\//, $metadata);
-    $self->{'metalist'} = \@metalist;
+    my @metadata_groups = split(/\//, $metadata);
+    $self->{'metadata_groups'} = \@metadata_groups;
 
     # The classifier button name
     if (!$buttonname) {
 	# Default: the first metadata element specified
-	my $firstmetagroupfirstelem = (split(/\;/, $metalist[0]))[0];
+	my $firstmetagroupfirstelem = (split(/\;/, $metadata_groups[0]))[0];
 	$buttonname = $self->generate_title_from_metadata($firstmetagroupfirstelem);
     }
@@ -120,19 +120,19 @@
 
     # Whether to group single items into a bookshelf (must be true for all metadata fields except the last)
-    foreach my $metagroup (@metalist) {
-	$self->{$metagroup . ".always_bookshelf"} = "t";
+    foreach my $metadata_group (@metadata_groups) {
+	$self->{$metadata_group . ".always_bookshelf"} = "t";
     }
     if (!$self->{'always_bookshelf_last_level'}) {
 	# Default: leave leafnodes ungrouped (equivalent to AZCompactList -mingroup 2)
-	my $lastmetagroup = $metalist[$#metalist];
-	$self->{$lastmetagroup . ".always_bookshelf"} = "f";
+	my $last_metadata_group = $metadata_groups[$#metadata_groups];
+	$self->{$last_metadata_group . ".always_bookshelf"} = "f";
     }
 
     # Whether to use an hlist or a vlist for each level in the hierarchy
-    foreach my $metagroup (@metalist) {
-	$self->{$metagroup . ".use_hlist"} = "f";
-    }
-    foreach my $metagroup (split(/\,/, $use_hlist_for)) {
-	$self->{$metagroup . ".use_hlist"} = "t";
+    foreach my $metadata_group (@metadata_groups) {
+	$self->{$metadata_group . ".use_hlist"} = "f";
+    }
+    foreach my $metadata_group (split(/\,/, $use_hlist_for)) {
+	$self->{$metadata_group . ".use_hlist"} = "t";
     }
 
@@ -147,6 +147,6 @@
     if (!$partition_size_within_level) {
 	# Default: 20
-	foreach my $metagroup (@metalist) {
-	    $self->{$metagroup . ".partition_size_within_level"} = 20;
+	foreach my $metadata_group (@metadata_groups) {
+	    $self->{$metadata_group . ".partition_size_within_level"} = 20;
 	}
     }
@@ -155,11 +155,11 @@
 
 	# Assign values based on the partition_size_within_level parameter
-	foreach my $metagroup (@metalist) {
+	foreach my $metadata_group (@metadata_groups) {
 	    my $partition_size_within_levelelem = shift(@partition_size_within_levellist);
 	    if (defined($partition_size_within_levelelem)) {
-		$self->{$metagroup . ".partition_size_within_level"} = $partition_size_within_levelelem;
+		$self->{$metadata_group . ".partition_size_within_level"} = $partition_size_within_levelelem;
 	    }
 	    else {
-		$self->{$metagroup . ".partition_size_within_level"} = $self->{$metalist[0] . ".partition_size_within_level"};
+		$self->{$metadata_group . ".partition_size_within_level"} = $self->{$metadata_groups[0] . ".partition_size_within_level"};
 	    }
 	}
@@ -167,9 +167,9 @@
 
     # The metadata elements to use to sort the leaf nodes
-    my @sort_leaf_nodes_usingmetalist = ( "Title" );
+    my @sort_leaf_nodes_usingmetadata_groups = ( "Title" );
     if ($sort_leaf_nodes_using) {
-	@sort_leaf_nodes_usingmetalist = split(/\|/, $sort_leaf_nodes_using);
-    }
-    $self->{'sort_leaf_nodes_usingmetalist'} = \@sort_leaf_nodes_usingmetalist;
+	@sort_leaf_nodes_usingmetadata_groups = split(/\|/, $sort_leaf_nodes_using);
+    }
+    $self->{'sort_leaf_nodes_usingmetadata_groups'} = \@sort_leaf_nodes_usingmetadata_groups;
 
     return bless $self, $class;
@@ -210,18 +210,18 @@
     my $section = shift(@_);
 
-    my @metalist = @{$self->{'metalist'}};
+    my @metadata_groups = @{$self->{'metadata_groups'}};
 
     # Only classify the document if it has a value for one of the metadata elements in the first group
-    foreach my $firstmetagroupelem (split(/\;/, $metalist[0])) {
+    foreach my $firstmetagroupelem (split(/\;/, $metadata_groups[0])) {
 	my $firstmetagroupelemvalue = $doc_obj->get_metadata_element($section, $firstmetagroupelem);
 	if (defined($firstmetagroupelemvalue) && $firstmetagroupelemvalue ne "") {
-	    push(@{$self->{'OIDlist'}}, $doc_OID);
+	    push(@{$self->{'OIDs'}}, $doc_OID);
 
 	    # Create a hash for the metadata values of each metadata element we're interested in
 	    my %metagroupsdone = ();
-	    foreach my $metagroup (@metalist, @{$self->{'sort_leaf_nodes_usingmetalist'}}) {
+	    foreach my $metadata_group (@metadata_groups, @{$self->{'sort_leaf_nodes_usingmetadata_groups'}}) {
 		# Take care not to do a metadata group more than once
-		unless ($metagroupsdone{$metagroup}) {
-		    foreach my $metaelem (split(/\;/, $metagroup)) {
+		unless ($metagroupsdone{$metadata_group}) {
+		    foreach my $metaelem (split(/\;/, $metadata_group)) {
 			my @metavalues = @{$doc_obj->get_metadata($section, $metaelem)};
 			foreach my $metavalue (@metavalues) {
@@ -229,10 +229,10 @@
 			    $metavalue =~ s/^\s*//;
 			    $metavalue =~ s/\s*$//;
-			    push(@{$self->{$metagroup . ".list"}->{$doc_OID}}, $metavalue);
+			    push(@{$self->{$metadata_group . ".list"}->{$doc_OID}}, $metavalue);
 			}
 			last if (@metavalues > 0);
 		    }
 
-		    $metagroupsdone{$metagroup} = 1;
+		    $metagroupsdone{$metadata_group} = 1;
 		}
 	    }
@@ -249,12 +249,12 @@
 
     # The metadata elements to classify by
-    my @metalist = @{$self->{'metalist'}};
-    my $firstmetagroup = $metalist[0];
+    my @metadata_groups = @{$self->{'metadata_groups'}};
+    my $first_metadata_group = $metadata_groups[0];
 
     # The OID values of the documents to include in the classification
-    my @OIDlist = @{$self->{'OIDlist'}};
+    my @OIDs = @{$self->{'OIDs'}};
 
     # The root node of the classification hierarchy
-    my $childtype = (($self->{$firstmetagroup . ".use_hlist"} eq "t") ? "HList" : "VList");
+    my $childtype = (($self->{$first_metadata_group . ".use_hlist"} eq "t") ? "HList" : "VList");
     my %classifyinfo = ( 'thistype' => "Invisible",
 			 'childtype' => $childtype,
@@ -263,5 +263,5 @@
 
     # Recursively create the classification hierarchy, one level for each metadata element
-    &add_az_list($self, \@metalist, \@OIDlist, \%classifyinfo);
+    &add_az_list($self, \@metadata_groups, \@OIDs, \%classifyinfo);
     return \%classifyinfo;
 }
@@ -271,18 +271,18 @@
 {
     my $self = shift(@_);
-    my @metalist = @{shift(@_)};
-    my @OIDlist = @{shift(@_)};
+    my @metadata_groups = @{shift(@_)};
+    my @OIDs = @{shift(@_)};
     my $classifyinfo = shift(@_);
     # print STDERR "\nAdding AZ list for " . $classifyinfo->{'Title'} . "\n";
 
-    my $metagroup = $metalist[0];
-    # print STDERR "Processing metadata group: " . $metagroup . "\n";
-    # print STDERR "Number of OID values: " . @OIDlist . "\n";
-
-    my %OIDtometavaluehash = %{$self->{$metagroup . ".list"}};
+    my $metadata_group = $metadata_groups[0];
+    # print STDERR "Processing metadata group: " . $metadata_group . "\n";
+    # print STDERR "Number of OID values: " . @OIDs . "\n";
+
+    my %OIDtometavaluehash = %{$self->{$metadata_group . ".list"}};
 
     # Create a mapping from metadata value to OID
     my %metavaluetoOIDhash = ();
-    foreach my $OID (@OIDlist) {
+    foreach my $OID (@OIDs) {
 	if ($OIDtometavaluehash{$OID}) {
 	    my @metavalues = @{$OIDtometavaluehash{$OID}};
@@ -307,5 +307,5 @@
 	    # Is this the start of a new partition?
 	    if ($metavaluepartition ne $lastpartition) {
-		&add_hlist_partition($self, \@metalist, $classifyinfo, $lastpartition, \%metavaluetoOIDsubhash);
+		&add_hlist_partition($self, \@metadata_groups, $classifyinfo, $lastpartition, \%metavaluetoOIDsubhash);
 		%metavaluetoOIDsubhash = ();
 		$lastpartition = $metavaluepartition;
@@ -316,5 +316,5 @@
 
 	# Don't forget to add the last partition
-	&add_hlist_partition($self, \@metalist, $classifyinfo, $lastpartition, \%metavaluetoOIDsubhash);
+	&add_hlist_partition($self, \@metadata_groups, $classifyinfo, $lastpartition, \%metavaluetoOIDsubhash);
 
 	# The partitions are stored in an HList
@@ -324,5 +324,5 @@
     else {
 	# Generate hlists of a certain size
-	my $partition_size_within_level = $self->{$metagroup . ".partition_size_within_level"};
+	my $partition_size_within_level = $self->{$metadata_group . ".partition_size_within_level"};
 	if ($partition_type_within_level =~ /^constant_size$/i && scalar(keys %metavaluetoOIDhash) > $partition_size_within_level) {
 	    my @sortedmetavalues = sort(keys %metavaluetoOIDhash);
@@ -349,5 +349,5 @@
 		    }
 
-		    &add_hlist_partition($self, \@metalist, $classifyinfo, $partitionname, \%metavaluetoOIDsubhash);
+		    &add_hlist_partition($self, \@metadata_groups, $classifyinfo, $partitionname, \%metavaluetoOIDsubhash);
 		    %metavaluetoOIDsubhash = ();
 		    $lastpartitionend = $partitionend;
@@ -361,5 +361,5 @@
 	# Otherwise just add all the values to a VList
 	else {
-	    &add_vlist($self, \@metalist, $classifyinfo, \%metavaluetoOIDhash);
+	    &add_vlist($self, \@metadata_groups, $classifyinfo, \%metavaluetoOIDhash);
 	}
     }
@@ -418,5 +418,5 @@
 {
     my $self = shift(@_);
-    my @metalist = @{shift(@_)};
+    my @metadata_groups = @{shift(@_)};
     my $classifyinfo = shift(@_);
     my $partitionname = shift(@_);
@@ -429,5 +429,5 @@
 
     # Add the children to the hlist partition
-    &add_vlist($self, \@metalist, \%subclassifyinfo, \%metavaluetoOIDhash);
+    &add_vlist($self, \@metadata_groups, \%subclassifyinfo, \%metavaluetoOIDhash);
     push(@{$classifyinfo->{'contains'}}, \%subclassifyinfo);
 }
@@ -437,17 +437,17 @@
 {
     my $self = shift(@_);
-    my @metalist = @{shift(@_)};
+    my @metadata_groups = @{shift(@_)};
     my $classifyinfo = shift(@_);
     my %metavaluetoOIDhash = %{shift(@_)};
 
-    my $metagroup = shift(@metalist);
+    my $metadata_group = shift(@metadata_groups);
 
     # Create an entry in the vlist for each value
     foreach my $metavalue (sort(keys %metavaluetoOIDhash)) {
-	my @OIDlist = @{$metavaluetoOIDhash{$metavalue}};
+	my @OIDs = @{$metavaluetoOIDhash{$metavalue}};
 
 	# If there is only one item and 'always_bookshelf' is false, add the item to the list
-	if (@OIDlist == 1 && $self->{$metagroup . ".always_bookshelf"} eq "f") {
-	    push(@{$classifyinfo->{'contains'}}, { 'OID' => $OIDlist[0] });
+	if (@OIDs == 1 && $self->{$metadata_group . ".always_bookshelf"} eq "f") {
+	    push(@{$classifyinfo->{'contains'}}, { 'OID' => $OIDs[0] });
 	}
 
@@ -459,22 +459,22 @@
 
 	    # If there are metadata elements remaining, recursively apply the process
-	    if (@metalist > 0) {
-		my $nextmetagroup = $metalist[0];
-		my $childtype = (($self->{$nextmetagroup . ".use_hlist"} eq "t") ? "HList" : "VList");
+	    if (@metadata_groups > 0) {
+		my $next_metadata_group = $metadata_groups[0];
+		my $childtype = (($self->{$next_metadata_group . ".use_hlist"} eq "t") ? "HList" : "VList");
 		$subclassifyinfo{'childtype'} = $childtype;
-		&add_az_list($self, \@metalist, \@OIDlist, \%subclassifyinfo);
+		&add_az_list($self, \@metadata_groups, \@OIDs, \%subclassifyinfo);
 	    }
 	    # Otherwise just add the documents as children of this list
 	    else {
 		# Sort the leaf nodes by the metadata elements specified with -sort_leaf_nodes_using
-		my @sort_leaf_nodes_usingmetalist = @{$self->{'sort_leaf_nodes_usingmetalist'}};
-		foreach my $sort_leaf_nodes_usingmetaelem (reverse @sort_leaf_nodes_usingmetalist) {
+		my @sort_leaf_nodes_usingmetadata_groups = @{$self->{'sort_leaf_nodes_usingmetadata_groups'}};
+		foreach my $sort_leaf_nodes_usingmetaelem (reverse @sort_leaf_nodes_usingmetadata_groups) {
 		    my %OIDtometavaluehash = %{$self->{$sort_leaf_nodes_usingmetaelem . ".list"}};
 		    # Force a stable sort (Perl 5.6's sort isn't stable)
 		    # !! The [0] bits aren't ideal (multiple metadata values) !! 
-		    @OIDlist = @OIDlist[ sort { $OIDtometavaluehash{$OIDlist[$a]}[0] cmp $OIDtometavaluehash{$OIDlist[$b]}[0] || $a <=> $b; } 0..$#OIDlist ];
+		    @OIDs = @OIDs[ sort { $OIDtometavaluehash{$OIDs[$a]}[0] cmp $OIDtometavaluehash{$OIDs[$b]}[0] || $a <=> $b; } 0..$#OIDs ];
 		}
 
-  		foreach my $OID (@OIDlist) {
+  		foreach my $OID (@OIDs) {
   		    push(@{$subclassifyinfo{'contains'}}, { 'OID' => $OID });
   		}
