Index: /main/trunk/greenstone2/perllib/plugins/BasePlugin.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/BasePlugin.pm	(revision 23456)
+++ /main/trunk/greenstone2/perllib/plugins/BasePlugin.pm	(revision 23457)
@@ -63,5 +63,5 @@
       { 'name' => "unicode",
 	'desc' => "{BasePlugin.encoding.unicode}" } ];
-      
+
 
 my $e = $encodings::encodings;
@@ -78,5 +78,5 @@
     [ { 'name' => "auto",
 	'desc' => "{BasePlugin.filename_encoding.auto}" },
-       { 'name' => "auto-language-analysis",
+      { 'name' => "auto-language-analysis",
 	'desc' => "{BasePlugin.filename_encoding.auto_language_analysis}" }, # textcat
       { 'name' => "auto-filesystem-encoding",
@@ -166,5 +166,5 @@
 	'list' => $file_rename_method_list,
 	'reqd' => "no"
-      }
+	}
       
       ];
@@ -384,21 +384,21 @@
 sub block_filename
 {
-	my $self = shift(@_);
-	my ($block_hash,$filename) = @_;
+    my $self = shift(@_);
+    my ($block_hash,$filename) = @_;
+    
+    if ($ENV{'GSDLOS'} =~ m/^windows$/) {
 	
-	if ($ENV{'GSDLOS'} =~ m/^windows$/) {
-		
-		my $lower_drive = $filename;
-		$lower_drive =~ s/^([A-Z]):/\l$1:/i;
-		
-		my $upper_drive = $filename;
-		$upper_drive =~ s/^([A-Z]):/\u$1:/i;
-		
-		$block_hash->{'file_blocks'}->{$lower_drive} = 1;
-		$block_hash->{'file_blocks'}->{$upper_drive} = 1;		
-	}
-	else {
-		$block_hash->{'file_blocks'}->{$filename} = 1;
-	}
+	my $lower_drive = $filename;
+	$lower_drive =~ s/^([A-Z]):/\l$1:/i;
+	
+	my $upper_drive = $filename;
+	$upper_drive =~ s/^([A-Z]):/\u$1:/i;
+	
+	$block_hash->{'file_blocks'}->{$lower_drive} = 1;
+	$block_hash->{'file_blocks'}->{$upper_drive} = 1;		
+    }
+    else {
+	$block_hash->{'file_blocks'}->{$filename} = 1;
+    }
 }
 
@@ -516,5 +516,5 @@
 	return undef; # can't recognise
     }
-   
+    
     # if we have a block_exp, then this overrides the normal 'smart' blocking
     $self->store_block_files($filename_full_path, $block_hash) unless ($self->{'no_blocking'} || $self->{'block_exp'} ne "");
@@ -524,5 +524,5 @@
 	$self->block_cover_image($filename_full_path, $block_hash); 
     }
-       
+    
     return 1;
 }
@@ -555,9 +555,9 @@
     # check if the filename is already in UTF8. If it is, then we're done.
     if($filename_encoding =~ m/auto/) {
-		if(&unicode::check_is_utf8($filemeta)) 
-		{
-			$filename_encoding = "utf8";
-			return $filemeta;
-		} 
+	if(&unicode::check_is_utf8($filemeta)) 
+	{
+	    $filename_encoding = "utf8";
+	    return $filemeta;
+	} 
     }
     
@@ -565,15 +565,15 @@
     if ($filename_encoding eq "auto") 
     {
-		# try textcat
-		$filename_encoding = $self->textcat_encoding($filemeta);
+	# try textcat
+	$filename_encoding = $self->textcat_encoding($filemeta);
 	
-		# check the locale next
-		$filename_encoding = $self->locale_encoding() if $filename_encoding eq "undefined";
+	# check the locale next
+	$filename_encoding = $self->locale_encoding() if $filename_encoding eq "undefined";
 	
-		
-		# now try the encoding of the document, if available
-		if ($filename_encoding eq "undefined" && defined $file_encoding) {
-			$filename_encoding = $file_encoding;
-		}
+	
+	# now try the encoding of the document, if available
+	if ($filename_encoding eq "undefined" && defined $file_encoding) {
+	    $filename_encoding = $file_encoding;
+	}
 
     }
@@ -602,5 +602,5 @@
 	# try textcat
 	$filename_encoding = $self->textcat_encoding($filemeta) if $filename_encoding eq "undefined";
-	    
+	
 	# else assume filename encoding is encoding of file content, if that's available
 	if ($filename_encoding eq "undefined" && defined $file_encoding) {
@@ -608,5 +608,5 @@
 	}
     }
-	
+    
     elsif ($filename_encoding eq "auto-lf") 
     {
@@ -622,5 +622,5 @@
 	$filename_encoding = $self->locale_encoding() if $filename_encoding eq "undefined";
     }
-    	
+    
     # if still undefined, use utf8 as fallback
     if ($filename_encoding eq "undefined") {
@@ -642,6 +642,6 @@
     if ($filename_encoding !~ m/(?:ascii|utf8|unicode)/) {
 	$filemeta = &unicode::unicode2utf8(
-	  &unicode::convert2unicode($filename_encoding, \$filemeta)
-	);
+					   &unicode::convert2unicode($filename_encoding, \$filemeta)
+					   );
     }
 
@@ -659,7 +659,7 @@
     my $outhandle = $self->{'outhandle'};
 
-	print $outhandle "****!!!!**** BasePlugin::filename_to_utf8_metadata now deprecated\n";
-	my ($cpackage,$cfilename,$cline,$csubr,$chas_args,$cwantarray) = caller(0);
-	print $outhandle "Calling method: $cfilename:$cline $cpackage->$csubr\n";
+    print $outhandle "****!!!!**** BasePlugin::filename_to_utf8_metadata now deprecated\n";
+    my ($cpackage,$cfilename,$cline,$csubr,$chas_args,$cwantarray) = caller(0);
+    print $outhandle "Calling method: $cfilename:$cline $cpackage->$csubr\n";
 
 
@@ -709,5 +709,5 @@
     my $outhandle = $self->{'outhandle'};
     my $best_encoding = undef;
-   
+    
     # get the language/encoding of the textstring using textcat
     require textcat;  # Only load the textcat module if it is required
@@ -727,5 +727,5 @@
 	return undef;
     } 
-        
+    
     if (defined $best_encoding && $best_encoding =~ m/^iso_8859/ && &unicode::check_is_utf8($text)) {
 	# the text is valid utf8, so assume that's the real encoding (since textcat is based on probabilities)
@@ -840,38 +840,38 @@
     # Start by looking for manually assigned metadata
     if (defined $gs_filename_encoding) {
-		if (ref ($gs_filename_encoding) eq "ARRAY") {
-			my $outhandle = $self->{'outhandle'};
-			
-			$deduced_filename_encoding = $gs_filename_encoding->[0];
-			
-			my $num_vals = scalar(@$gs_filename_encoding);
-			if ($num_vals>1) {
-				print $outhandle "Warning: gs.filename_encoding multiply defined for $file\n";
-				print $outhandle "         Selecting first value: $deduced_filename_encoding\n";
-			}
-		} 
-		else {
-			$deduced_filename_encoding = $gs_filename_encoding;
-		}
-    }
-        
+	if (ref ($gs_filename_encoding) eq "ARRAY") {
+	    my $outhandle = $self->{'outhandle'};
+	    
+	    $deduced_filename_encoding = $gs_filename_encoding->[0];
+	    
+	    my $num_vals = scalar(@$gs_filename_encoding);
+	    if ($num_vals>1) {
+		print $outhandle "Warning: gs.filename_encoding multiply defined for $file\n";
+		print $outhandle "         Selecting first value: $deduced_filename_encoding\n";
+	    }
+	} 
+	else {
+	    $deduced_filename_encoding = $gs_filename_encoding;
+	}
+    }
+    
     if (!defined $deduced_filename_encoding || ($deduced_filename_encoding =~ m/^\s*$/)) {
-		# Look to see if plugin specifies this value
-
-		if (defined $plugin_filename_encoding) {
-			# First look to see if we're using any of the "older" (i.e. deprecated auto-... plugin options)
-			if ($plugin_filename_encoding =~ m/^auto-.*$/) {
-				my $outhandle = $self->{'outhandle'};
-				print $outhandle "Warning: $plugin_filename_encoding is no longer supported\n";
-				print $outhandle "         default to 'auto'\n";
-				$self->{'filename_encoding'} = $plugin_filename_encoding = "auto";
-			}
-			
-			if ($plugin_filename_encoding ne "auto") {
-				# We've been given a specific filenamne encoding
-				# => so use it!
-				$deduced_filename_encoding = $plugin_filename_encoding;
-			}
-		}
+	# Look to see if plugin specifies this value
+
+	if (defined $plugin_filename_encoding) {
+	    # First look to see if we're using any of the "older" (i.e. deprecated auto-... plugin options)
+	    if ($plugin_filename_encoding =~ m/^auto-.*$/) {
+		my $outhandle = $self->{'outhandle'};
+		print $outhandle "Warning: $plugin_filename_encoding is no longer supported\n";
+		print $outhandle "         default to 'auto'\n";
+		$self->{'filename_encoding'} = $plugin_filename_encoding = "auto";
+	    }
+	    
+	    if ($plugin_filename_encoding ne "auto") {
+		# We've been given a specific filenamne encoding
+		# => so use it!
+		$deduced_filename_encoding = $plugin_filename_encoding;
+	    }
+	}
     }
     
@@ -892,8 +892,8 @@
 	    # See if we can determine the file system encoding through locale
 	    $deduced_filename_encoding = $self->locale_encoding();
-	
+	    
 	    # if locale shows us filesystem is utf8, check to see filename is consistent
 	    # => if not, then we have an "alien" filename on our hands
-	    
+
 	    if ($deduced_filename_encoding =~ m/^utf-?8$/i) {
 		if (!&unicode::check_is_utf8($file)) {
@@ -910,15 +910,15 @@
 #    }
 
-	if ($self->{'verbosity'}>3) {
-		my $outhandle = $self->{'outhandle'};
-
-		if (defined $deduced_filename_encoding) {
-			print $outhandle "  Deduced filename encoding as: $deduced_filename_encoding\n";
-		}
-		else {
-			print $outhandle "  No filename encoding deduced\n";
-		}
-	}
-	
+    if ($self->{'verbosity'}>3) {
+	my $outhandle = $self->{'outhandle'};
+
+	if (defined $deduced_filename_encoding) {
+	    print $outhandle "  Deduced filename encoding as: $deduced_filename_encoding\n";
+	}
+	else {
+	    print $outhandle "  No filename encoding deduced\n";
+	}
+    }
+    
     return $deduced_filename_encoding;
 }
@@ -998,5 +998,5 @@
 #    }
 }
-   
+
 # this should be called by all plugins to set the oid of the doc obj, rather
 # than calling doc_obj->set_OID directly
@@ -1017,5 +1017,5 @@
 
 }
-  
+
 # The BasePlugin read_into_doc_obj() function. This function does all the
 # right things to make general options work for a given plugin.  It doesn't do anything with the file other than setting reads in
@@ -1045,8 +1045,8 @@
     my $pp_file = &util::prettyprint_file($base_dir,$file);
     print $outhandle "$self->{'plugin_type'} processing $pp_file\n"
-	    if $self->{'verbosity'} > 1;
+	if $self->{'verbosity'} > 1;
 
     my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
-	
+    
     # create a new document
     my $doc_obj = new doc ($filename_full_path, "indexed_doc", $self->{'file_rename_method'});
@@ -1055,5 +1055,5 @@
     $doc_obj->add_utf8_metadata($top_section, "Plugin", "$self->{'plugin_type'}");
     $doc_obj->add_utf8_metadata($top_section, "FileSize", (-s $filename_full_path));
- 
+    
 
     my $plugin_filename_encoding = $self->{'filename_encoding'};
@@ -1123,5 +1123,5 @@
 	$self->associate_source_file($doc_obj, $filename);
     }
-   
+    
 
 }
@@ -1192,8 +1192,8 @@
     gsprintf(STDERR, "BasePlugin::process {common.must_be_implemented}\n");
 
-	my ($cpackage,$cfilename,$cline,$csubr,$chas_args,$cwantarray) = caller(1);
+    my ($cpackage,$cfilename,$cline,$csubr,$chas_args,$cwantarray) = caller(1);
     print STDERR "Calling method: $cfilename:$cline $cpackage->$csubr\n";
 
-	die "\n";
+    die "\n";
 
     return undef; # never gets here
@@ -1215,6 +1215,6 @@
     if (!open (FILE, ">:utf8", $filename)) {
 	gsprintf(STDERR, "ConvertToPlug::write_file {ConvertToPlug.could_not_open_for_writing} ($!)\n", $filename);
-	 die "\n";
-     }
+	die "\n";
+    }
     print FILE $$textref;
     
@@ -1265,7 +1265,7 @@
 	} 
     }
-	    
-}
-  
+    
+}
+
 # add any extra metadata that's been passed around from one
 # plugin to another.
