Index: /gsdl/trunk/perllib/plugins/ArchivesInfPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/ArchivesInfPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/ArchivesInfPlugin.pm	(revision 16392)
@@ -109,5 +109,5 @@
 sub read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs,$total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs,$total_count, $gli) = @_;
     my $outhandle = $self->{'outhandle'};
 
@@ -137,5 +137,5 @@
 	    my $tmp = &util::filename_cat ($file, $subfile->[0]);
 	    next if $tmp eq $file;
-
+	    
 	    # We always process the file...
 	    my $process_file = 1;
@@ -156,5 +156,5 @@
 	    if ($process_file) {
 		# note: metadata is not carried on to the next level
-		$count += &plugin::read ($pluginfo, $base_dir, $tmp, {}, $processor, $maxdocs, ($total_count+$count), $gli);
+		$count += &plugin::read ($pluginfo, $base_dir, $tmp, $block_hash, {}, $processor, $maxdocs, ($total_count+$count), $gli);
 	    }
 
Index: /gsdl/trunk/perllib/plugins/CONTENTdmPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/CONTENTdmPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/CONTENTdmPlugin.pm	(revision 16392)
@@ -557,9 +557,9 @@
 
 # Override ConvertBinaryFile read
-# Needed so multiple .item files generate are sent down secondary plugin
+# Needed so multiple .item files generated are sent down secondary plugin
 
 sub read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
 
     $self->{'gli'} = $gli;
@@ -570,6 +570,7 @@
     my $outhandle = $self->{'outhandle'};
     
-    my ($block_status,$filename) = $self->read_block(@_);
-    return $block_status if ((!defined $block_status) || ($block_status==0));
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
+    return undef unless $self->can_process_this_file($filename_full_path);
+
     $file =~ s/^[\/\\]+//; # $file often begins with / so we'll tidy it up
        
@@ -580,5 +581,5 @@
     my $conv_filename_list = [];
 
-    $conv_filename_list = $self->tmp_area_convert_file($output_ext, $filename);
+    $conv_filename_list = $self->tmp_area_convert_file($output_ext, $filename_full_path);
     
     if (scalar(@$conv_filename_list)==0) {
@@ -611,5 +612,5 @@
 	my ($rv,$doc_obj) 
 	    = $secondary_plugin->read_into_doc_obj ($pluginfo,"", $conv_filename, 
-						    $metadata, $processor, $maxdocs, $total_count,
+						    $block_hash, $metadata, $processor, $maxdocs, $total_count,
 						    $gli);
 
@@ -619,5 +620,5 @@
 
 	# Override previous gsdlsourcefilename set by secondary plugin
-	my $collect_file = &util::filename_within_collection($filename);
+	my $collect_file = &util::filename_within_collection($filename_full_path);
 	my $collect_conv_file = &util::filename_within_collection($conv_filename);
 	$doc_obj->set_source_filename ($collect_file); 
@@ -627,8 +628,8 @@
 	$self->set_Source_metadata($doc_obj, $filemeta);
 	$doc_obj->set_utf8_metadata_element($doc_obj->get_top_section(), "Plugin", "$self->{'plugin_type'}");
-	$doc_obj->set_utf8_metadata_element($doc_obj->get_top_section(), "FileSize", (-s $filename));
+	$doc_obj->set_utf8_metadata_element($doc_obj->get_top_section(), "FileSize", (-s $filename_full_path));
 	
 	if ($self->{'cover_image'}) {
-	    $self->associate_cover_image($doc_obj, $filename);
+	    $self->associate_cover_image($doc_obj, $filename_full_path);
 	}
 	
Index: /gsdl/trunk/perllib/plugins/ConvertBinaryFile.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/ConvertBinaryFile.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/ConvertBinaryFile.pm	(revision 16392)
@@ -366,9 +366,9 @@
 sub read_into_doc_obj {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
 
     my $outhandle = $self->{'outhandle'};
 
-    my ($filename_full_path, $filename_no_path) = $self->get_full_filenames($base_dir, $file);
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
 
     my $output_ext = $self->{'convert_to_ext'};
@@ -411,6 +411,7 @@
 
     # note: metadata is not carried on to the next level
+## **** I just replaced $metadata with {} in following
     my ($rv,$doc_obj) 
-	= $secondary_plugin->read_into_doc_obj ($pluginfo,"", $conv_filename, $metadata, $processor, $maxdocs, $total_count, $gli);
+	= $secondary_plugin->read_into_doc_obj ($pluginfo,"", $conv_filename, $block_hash, {}, $processor, $maxdocs, $total_count, $gli);
 
     if ((!defined $rv) || ($rv<1)) {
@@ -438,4 +439,6 @@
     my $topsection = $doc_obj->get_top_section();
     $self->add_associated_files($doc_obj, $filename_full_path);
+
+    # extra_metadata is already called by sec plugin in process??
     $self->extra_metadata($doc_obj, $topsection, $metadata); # do we need this here??
     # do any automatic metadata extraction
Index: /gsdl/trunk/perllib/plugins/ConvertToRogPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/ConvertToRogPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/ConvertToRogPlugin.pm	(revision 16392)
@@ -311,11 +311,10 @@
 sub read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
 
     my $outhandle = $self->{'outhandle'};
 
-    # check process_exp, block_exp, associate_ext etc
-    my ($block_status,$filename) = $self->read_block(@_);    
-    return $block_status if ((!defined $block_status) || ($block_status==0));
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
+    return undef unless $self->can_process_this_file($filename_full_path);
  
     $file =~ s/^[\/\\]+//; # $file often begins with / so we'll tidy it up
@@ -325,5 +324,5 @@
 
     my $output_ext = $self->{'convert_to_ext'};
-    my $conv_filename = $self->tmp_area_convert_file($output_ext, $filename);
+    my $conv_filename = $self->tmp_area_convert_file($output_ext, $filename_full_path);
 
     if ("$conv_filename" eq "") {return 0;} # allows continue on errors
@@ -334,5 +333,5 @@
     #my $doc_obj = new doc ($conv_filename, "indexed_doc");
     # the original filename is used now
-    my $doc_obj = new doc ($filename, "indexed_doc");
+    my $doc_obj = new doc ($filename_full_path, "indexed_doc");
     # the converted filename is set separately
     $doc_obj->set_converted_filename($conv_filename);
@@ -349,8 +348,8 @@
     
     if ($self->{'cover_image'}) {
-	$self->associate_cover_image($doc_obj, $filename);
+	$self->associate_cover_image($doc_obj, $filename_full_path);
     }
     $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "Plugin", "$self->{'plugin_type'}");
-    $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "FileSize", (-s $filename));
+    $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "FileSize", (-s $filename_full_path));
 
     my $track_no = "1";
Index: /gsdl/trunk/perllib/plugins/DBPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/DBPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/DBPlugin.pm	(revision 16392)
@@ -80,10 +80,10 @@
 sub read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs,$total_count,$gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs,$total_count,$gli) = @_;
         
      #see if we can handle the passed file...
-     my ($block_status,$filename) = $self->read_block(@_);    
-     return $block_status if ((!defined $block_status) || ($block_status==0));
-
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
+    return undef unless $self->can_process_this_file($filename_full_path);
+    
     my $outhandle = $self->{'outhandle'};
     my $verbosity = $self->{'verbosity'};
@@ -120,6 +120,6 @@
 
     # read in config file.
-    if (!open (CONF, $filename)) {
-	    print $outhandle "DBPlugin: can't read $filename: $!\n";
+    if (!open (CONF, $filename_full_path)) {
+	    print $outhandle "DBPlugin: can't read $filename_full_path: $!\n";
 	    return 0;
     } 
@@ -172,5 +172,5 @@
 		    $err =~ s/\.$//; # remove a trailing .
 		    print $outhandle "DBPlugin: error evaluating `$statement'\n";
-		    print $outhandle " $err (in $filename)\n";
+		    print $outhandle " $err (in $filename_full_path)\n";
 		    return 0; # there was an error reading the config file
 		}
@@ -189,5 +189,5 @@
     
     if (!defined($db)) {
-	print $outhandle "DBPlugin: error: $filename does not specify a db!\n";
+	print $outhandle "DBPlugin: error: $filename_full_path does not specify a db!\n";
 	return 0;
     }
@@ -254,5 +254,5 @@
 
 	# create a new document
-	my $doc_obj = new doc ($filename, "indexed_doc");
+	my $doc_obj = new doc ($filename_full_path, "indexed_doc");
 	$doc_obj->set_OIDtype ($processor->{'OIDtype'}, $processor->{'OIDmetadata'});
 	my $cursection = $doc_obj->get_top_section();
@@ -272,5 +272,5 @@
 
 	if ($self->{'cover_image'}) {
-	    $self->associate_cover_image($doc_obj, $filename);
+	    $self->associate_cover_image($doc_obj, $filename_full_path);
 	}
 	$doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "Plugin", "$self->{'plugin_type'}");
Index: /gsdl/trunk/perllib/plugins/DSpacePlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/DSpacePlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/DSpacePlugin.pm	(revision 16392)
@@ -240,5 +240,5 @@
 sub metadata_read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
 
     my $only_first_doc = $self->{'only_first_doc'};
@@ -322,5 +322,5 @@
 sub read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
     my $outhandle = $self->{'outhandle'};
     
Index: /gsdl/trunk/perllib/plugins/FOXPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/FOXPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/FOXPlugin.pm	(revision 16392)
@@ -93,21 +93,21 @@
 sub read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
  
-    #check for associate_ext, blocking etc, are we processing this file?
-    my ($block_status,$fullname) = $self->read_block(@_);    
-    return $block_status if ((!defined $block_status) || ($block_status==0));
+    # can we process this file??
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
+    return undef unless $self->can_process_this_file($filename_full_path);
 
     print STDERR "<Processing n='$file' p='FOXPlugin'>\n" if ($gli);
     print STDERR "FOXPlugin: processing $file\n" if $self->{'verbosity'} > 1;
 
-    my ($parent_dir) = $fullname =~ /^(.*)\/[^\/]+\.dbf$/i;
+    my ($parent_dir) = $filename_full_path =~ /^(.*)\/[^\/]+\.dbf$/i;
 
     # open the file
-    if (!open (FOXBASEIN, $fullname)) {
+    if (!open (FOXBASEIN, $filename_full_path)) {
 	if ($gli) {
-	    print STDERR "<ProcessingError n='$file' r='Could not read $fullname'>\n";
-	}
-	print STDERR "FOXPlugin::read - couldn't read $fullname\n";
+	    print STDERR "<ProcessingError n='$file' r='Could not read $filename_full_path'>\n";
+	}
+	print STDERR "FOXPlugin::read - couldn't read $filename_full_path\n";
 	return -1; # error in processing
     }
@@ -141,5 +141,5 @@
 	    print STDERR "<ProcessingError n='$file' r='Does not seem to be a Foxbase file'>\n";
 	}
-	print STDERR "FOXPlugin:read - $fullname doesn't seem to be a Foxbase file\n";
+	print STDERR "FOXPlugin:read - $filename_full_path doesn't seem to be a Foxbase file\n";
 	return -1;
     }
@@ -163,6 +163,6 @@
 
     # open the dbt file if we need to
-    my $dbtfullname = $fullname;
-    if ($fullname =~ /f$/) {
+    my $dbtfullname = $filename_full_path;
+    if ($filename_full_path =~ /f$/) {
 	$dbtfullname =~ s/f$/t/;
     } else {
Index: /gsdl/trunk/perllib/plugins/GMLPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/GMLPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/GMLPlugin.pm	(revision 16392)
@@ -79,10 +79,10 @@
 sub read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
     my $outhandle = $self->{'outhandle'};
 
-    #check process and block exps, smart block, etc
-    my ($block_status,$filename) = $self->read_block(@_);    
-    return $block_status if ((!defined $block_status) || ($block_status==0));
+    # can we process this file??
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
+    return undef unless $self->can_process_this_file($filename_full_path);
 
     $file =~ s/^[\/\\]+//; # $file often begins with / so we'll tidy it up
@@ -95,9 +95,9 @@
     $parent_dir = &util::filename_cat ($base_dir, $parent_dir);
 
-    if (!open (INFILE, $filename)) {
+    if (!open (INFILE, $filename_full_path)) {
 	if ($gli) {
-	    print STDERR "<ProcessingError n='$file' r='Could not read $filename'>\n";
+	    print STDERR "<ProcessingError n='$file' r='Could not read $filename_full_path'>\n";
 	}
-	print $outhandle "GMLPlugin::read - couldn't read $filename\n";
+	print $outhandle "GMLPlugin::read - couldn't read $filename_full_path\n";
 	return -1;
     }
@@ -133,5 +133,5 @@
 
 		} else {
-		    print $outhandle "GMLPlugin::read - error in file $filename\n";
+		    print $outhandle "GMLPlugin::read - error in file $filename_full_path\n";
 		    print $outhandle "text: \"$gml\"\n";
 		    last;
Index: /gsdl/trunk/perllib/plugins/HBPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/HBPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/HBPlugin.pm	(revision 16392)
@@ -219,5 +219,5 @@
 sub read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
     my $outhandle = $self->{'outhandle'};
 
Index: /gsdl/trunk/perllib/plugins/HTMLPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/HTMLPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/HTMLPlugin.pm	(revision 16392)
@@ -491,10 +491,6 @@
 {
     my $self = shift (@_);  
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
-    
-    # check the process_exp and block_exp thing
-    my ($block_status,$filename) = $self->read_block(@_);    
-    return $block_status if ((!defined $block_status) || ($block_status==0));
-    
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+        
     # get the input file
     my $input_filename = $file;
@@ -523,5 +519,5 @@
     
     # call the parent read_into_doc_obj
-    my ($process_status,$doc_obj) = $self->SUPER::read_into_doc_obj($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli);
+    my ($process_status,$doc_obj) = $self->SUPER::read_into_doc_obj($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli);
     
     return ($process_status,$doc_obj);
@@ -554,5 +550,6 @@
     my $self = shift (@_);
     
-    return q^(?i)\.(gif|jpe?g|jpe|jpg|png|css)$^;
+    #return q^(?i)\.(gif|jpe?g|jpe|jpg|png|css)$^;
+    return "";
 }
 
@@ -567,13 +564,14 @@
 {
     my $self =shift (@_);
-    my ($filename) = @_;
-    my $html_fname = $filename;
+    my ($filename_full_path, $block_hash) = @_;
+
+    my $html_fname = $filename_full_path;
     my @file_blocks;
     
-    my ($language, $encoding) = $self->textcat_get_language_encoding ($filename);
+    my ($language, $encoding) = $self->textcat_get_language_encoding ($filename_full_path);
 
     # read in file ($text will be in utf8)
     my $text = "";
-    $self->read_file ($filename, $encoding, $language, \$text);
+    $self->read_file ($filename_full_path, $encoding, $language, \$text);
     my $textref = \$text;
     my $opencom = '(?:<!--|&lt;!(?:&mdash;|&#151;|--))';
@@ -600,10 +598,10 @@
 	if ($link !~ m@^/@ && $link !~ m/^([A-Z]:?)\\/) {
 	    # Turn relative file path into full path
-	    my $dirname = &File::Basename::dirname($filename);
+	    my $dirname = &File::Basename::dirname($filename_full_path);
 	    $link = &util::filename_cat($dirname, $link);
 	}
 	$link = $self->eval_dir_dots($link);
 	
-	$self->{'file_blocks'}->{$link} = 1;
+	$block_hash->{'file_blocks'}->{$link} = 1;
     }
 }
Index: /gsdl/trunk/perllib/plugins/ISISPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/ISISPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/ISISPlugin.pm	(revision 16392)
@@ -88,5 +88,6 @@
 # This plugin blocks files with the suffix ".fdt" and ".xrf"
 sub get_default_block_exp {
-    return q^(?i)(\.fdt|\.xrf)$^;
+    #return q^(?i)(\.fdt|\.xrf)$^;
+    return "";
 }
 
@@ -122,15 +123,28 @@
 }
 
-
-sub read_file
-{
+# we block the corresponding fdt and xrf
+sub store_block_files {
+    
+    my $self =shift (@_);
+    my ($filename_full_path, $block_hash) = @_;
+    
+    $self->check_auxiliary_files($filename_full_path);
+    if (-e $self->{'fdt_file_path'}) {
+	my $fdt_file = $self->{'fdt_file_path'};
+	$block_hash->{'file_blocks'}->{$fdt_file} = 1;
+    }
+    if (-e $self->{'xrf_file_path'}) {
+	my $xrf_file = $self->{'xrf_file_path'};
+	$block_hash->{'file_blocks'}->{$xrf_file} = 1;
+    }
+    
+
+}
+
+sub check_auxiliary_files {
     my $self = shift (@_);
-    my ($filename, $encoding, $language, $textref) = @_;
-    my $outhandle = $self->{'outhandle'};
+    my ($filename) = @_;
 
     my ($database_file_path_root) = ($filename =~ /(.*)\.mst$/i);
-    my $mst_file_path_relative = $filename;
-    $mst_file_path_relative =~ s/^.+import.(.*?)$/$1/;
-
     # Check the associated .fdt and .xrf files exist
     $self->{'fdt_file_path'} = $database_file_path_root . ".FDT";
@@ -138,12 +152,28 @@
 	$self->{'fdt_file_path'} = $database_file_path_root . ".fdt";
     }
+    $self->{'xrf_file_path'} = $database_file_path_root . ".XRF";
+    if (!-e $self->{'xrf_file_path'}) {
+	$self->{'xrf_file_path'} = $database_file_path_root . ".xrf";
+    }
+}
+    
+
+sub read_file
+{
+    my $self = shift (@_);
+    my ($filename, $encoding, $language, $textref) = @_;
+    my $outhandle = $self->{'outhandle'};
+
+    my ($database_file_path_root) = ($filename =~ /(.*)\.mst$/i);
+    my $mst_file_path_relative = $filename;
+    $mst_file_path_relative =~ s/^.+import.(.*?)$/$1/;
+
+    # Check the associated .fdt and .xrf files exist
+    $self->check_auxiliary_files($filename);
+    
     if (!-e $self->{'fdt_file_path'}) {
 	print STDERR "<ProcessingError n='$mst_file_path_relative' r='Could not find ISIS FDT file $self->{'fdt_file_path'}'>\n" if ($self->{'gli'});
 	print $outhandle "Error: Could not find ISIS FDT file " . $self->{'fdt_file_path'} . ".\n";
 	return;
-    }
-    $self->{'xrf_file_path'} = $database_file_path_root . ".XRF";
-    if (!-e $self->{'xrf_file_path'}) {
-	$self->{'xrf_file_path'} = $database_file_path_root . ".xrf";
     }
     if (!-e $self->{'xrf_file_path'}) {
Index: /gsdl/trunk/perllib/plugins/IndexPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/IndexPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/IndexPlugin.pm	(revision 16392)
@@ -98,5 +98,5 @@
 sub read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
     my $outhandle = $self->{'outhandle'};
 
@@ -148,5 +148,5 @@
 		}
 	    }
-	    $count += &plugin::read ($pluginfo, $index_base_dir, $docfile, $metadata, $processor, $maxdocs, ($total_count +$count), $gli);
+	    $count += &plugin::read ($pluginfo, $index_base_dir, $docfile, $block_hash, $metadata, $processor, $maxdocs, ($total_count +$count), $gli);
 	}
     }
Index: /gsdl/trunk/perllib/plugins/LOMPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/LOMPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/LOMPlugin.pm	(revision 16392)
@@ -106,22 +106,23 @@
 
 
-
+sub can_process_this_file {
+    my $self = shift(@_);
+    my ($filename) = @_;
+
+    if ($self->SUPER::can_process_this_file($filename) && $self->check_doctype($filename)) {
+	return 1; # its a file for us
+    }
+    return 0;
+}
 
 sub metadata_read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
 
     my $outhandle = $self->{'outhandle'};
 
-    my $filename = $file;
-    $filename = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/;
-    
-    if ($filename !~ /$self->{'process_exp'}/ || !-f $filename) {
-	return undef; # can't recognise
-    }
-    if (!$self->check_doctype($filename)) {
-	# this file is not for us
-	return undef;
-    }
+    # can we process this file??
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
+    return undef unless $self->can_process_this_file($filename_full_path);
 
     $file =~ s/^[\/\\]+//; # $file often begins with / so we'll tidy it up
@@ -130,13 +131,13 @@
 	if $self->{'verbosity'} > 1;
 
-    my ($dir,$tail) = $filename =~ /^(.*?)([^\/\\]*)$/;
+    my ($dir,$tail) = $filename_full_path =~ /^(.*?)([^\/\\]*)$/;
     $self->{'output_dir'} = $dir;
 
     eval {
-	$self->{'parser'}->parsefile($filename);
+	$self->{'parser'}->parsefile($filename_full_path);
     };
     
     if ($@) {
-	print $outhandle "LOMPlugin: skipping $filename as not conformant to LOM syntax\n" if ($self->{'verbosity'} > 1);
+	print $outhandle "LOMPlugin: skipping $filename_full_path as not conformant to LOM syntax\n" if ($self->{'verbosity'} > 1);
 	print $outhandle "\n Perl Error:\n $@\n" if ($self->{'verbosity'}>2);
 	return 0;
@@ -212,5 +213,5 @@
 sub read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
 
     my $outhandle = $self->{'outhandle'};
@@ -218,11 +219,7 @@
     return 0 if (defined $self->{'extra_blocks'}->{$file});
 
-    # need to check whether this file is for us
-    my ($block_status,$filename) = $self->read_block(@_);    
-    return $block_status if ((!defined $block_status) || ($block_status==0));
-    if (!$self->check_doctype($filename)) {
-	# this file is not for us
-	return undef;
-    }
+    # can we process this file??
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
+    return undef unless $self->can_process_this_file($filename_full_path);
 
     $self->{'metadata_table'} = $metadata;
Index: /gsdl/trunk/perllib/plugins/MP3Plugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/MP3Plugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/MP3Plugin.pm	(revision 16392)
@@ -89,5 +89,5 @@
     my ($pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
 
-    my ($filename_full_path, $filename_no_path) = $self->get_full_filenames($base_dir, $file);
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
     # do something about OIDtype so no hashing
      
Index: /gsdl/trunk/perllib/plugins/OAIPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/OAIPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/OAIPlugin.pm	(revision 16392)
@@ -162,5 +162,5 @@
     my $self = shift (@_);  
   
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
 
     my $outhandle = $self->{'outhandle'};
@@ -208,5 +208,6 @@
 	    
 	    return &plugin::read ($pluginfo, $filename_dir, $url_array->[0],
-				  $metadata, $processor, $maxdocs, $total_count, $gli);
+				  $block_hash, $metadata, $processor, $maxdocs,
+				  $total_count, $gli);
 	}
 	else
Index: /gsdl/trunk/perllib/plugins/OggVorbisPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/OggVorbisPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/OggVorbisPlugin.pm	(revision 16392)
@@ -86,5 +86,5 @@
     my ($pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
 
-    my ($filename_full_path, $filename_no_path) = $self->get_full_filenames($base_dir, $file);
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
     # do something about OIDtype so no hashing
      
Index: /gsdl/trunk/perllib/plugins/OpenDocumentPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/OpenDocumentPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/OpenDocumentPlugin.pm	(revision 16392)
@@ -161,9 +161,9 @@
     my $self = shift (@_);  
    
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
-
-    # check process and block exps, smart block, associate_ext etc
-    my ($block_status,$filename) = $self->read_block(@_);    
-    return $block_status if ((!defined $block_status) || ($block_status==0));
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+
+    # can we process this file??
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
+    return undef unless $self->can_process_this_file($filename_full_path);
 
     my $outhandle = $self->{'outhandle'};
@@ -175,5 +175,5 @@
     $file =~ s/^[\/\\]+//; # $file often begins with / so we'll tidy it up
     $self->{'file'} = $file;
-    $self->{'filename'} = $filename;
+    $self->{'filename'} = $filename_full_path;
     $self->{'processor'} = $processor;
     $self->{'metadata'} = $metadata;
@@ -189,5 +189,5 @@
 	my $cwd = getcwd();
 	chdir ($tmpdir) || die "Unable to change to $tmpdir";
-	&util::cp ($filename, $tmpdir);
+	&util::cp ($filename_full_path, $tmpdir);
 	
 	$self->unzip ("\"$file_only\"");
@@ -197,5 +197,5 @@
 	    }
 	}
-	$self->close_document($filename,$file_only);
+	$self->close_document($filename_full_path,$file_only);
 	
 	chdir ($cwd) || die "Unable to change back to $cwd";
Index: /gsdl/trunk/perllib/plugins/ReadTextFile.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/ReadTextFile.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/ReadTextFile.pm	(revision 16392)
@@ -122,8 +122,7 @@
 sub read_into_doc_obj {
     my $self = shift (@_);  
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
 
     my $outhandle = $self->{'outhandle'};
-
     # should we move this to read? What about secondary plugins?
     print STDERR "<Processing n='$file' p='$self->{'plugin_type'}'>\n" if ($gli);
@@ -131,5 +130,6 @@
 	    if $self->{'verbosity'} > 1;
 
-    my ($filename_full_path, $filename_no_path) =  $self->get_full_filenames($base_dir, $file);
+    my ($filename_full_path, $filename_no_path) =  &util::get_full_filenames($base_dir, $file);
+
     # Do encoding stuff
     my ($language, $encoding) = $self->textcat_get_language_encoding ($filename_full_path);
Index: /gsdl/trunk/perllib/plugins/ReadXMLFile.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/ReadXMLFile.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/ReadXMLFile.pm	(revision 16392)
@@ -157,4 +157,14 @@
     return $transformed_xml;
 
+}
+
+sub can_process_this_file {
+    my $self = shift(@_);
+    my ($filename) = @_;
+
+    if ($self->SUPER::can_process_this_file($filename) && $self->check_doctype($filename)) {
+	return 1; # its a file for us
+    }
+    return 0;
 }
 
@@ -188,22 +198,4 @@
 }
 
-# because we are not just using process_exp to determine whether to process or not, we need to implement this too, so that a file can be passed down if we are not actually processing it
-sub metadata_read {
-    my $self = shift (@_);
-    
-    my ($pluginfo, $base_dir, $file, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
- 
-    my $result = $self->SUPER::metadata_read($pluginfo, $base_dir, $file, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli);
-
-    if (defined $result) {
-	# we think we are processing this, but check that we actually are
-	my ($filename_full_path, $filename_no_path) = $self->get_full_filenames($base_dir, $file);
-
-	if ($self->check_doctype($filename_full_path)) {
-	    return $result;
-	}
-    }
-    return undef;
-}
 
 # we need to implement read cos we are not just using process_exp to determine
@@ -212,16 +204,10 @@
     my $self = shift (@_);  
   
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
-
-    # Make sure we're processing the correct file, do blocking etc
-    my ($block_status,$filename_full_path) = $self->read_block(@_);    
-    return $block_status if ((!defined $block_status) || ($block_status==0));
-
-    ## check the doctype to see whether we really want to process the file
-    if (!$self->check_doctype($filename_full_path)) {
-	# this file is not for us
-	return undef;
-    }
-
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+
+    # can we process this file??
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
+    return undef unless $self->can_process_this_file($filename_full_path);
+    
     $file =~ s/^[\/\\]+//; # $file often begins with / so we'll tidy it up
     $self->{'base_dir'} = $base_dir;
Index: /gsdl/trunk/perllib/plugins/RealMediaPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/RealMediaPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/RealMediaPlugin.pm	(revision 16392)
@@ -82,5 +82,5 @@
     my ($pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
 
-    my ($filename_full_path, $filename_no_path) = $self->get_full_filenames($base_dir, $file);
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
     my $top_section = $doc_obj->get_top_section();
     # prevent hashing: old code was in effect the following. 
Index: /gsdl/trunk/perllib/plugins/RogPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/RogPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/RogPlugin.pm	(revision 16392)
@@ -222,5 +222,5 @@
 sub read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
 
     my $filename = &util::filename_cat($base_dir, $file);
Index: /gsdl/trunk/perllib/plugins/SplitTextFile.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/SplitTextFile.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/SplitTextFile.pm	(revision 16392)
@@ -118,8 +118,9 @@
 sub metadata_read {
     my $self = shift (@_);  
-    my ($pluginfo, $base_dir, $file, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
 
     # returns 1 if matches process_exp, and has done blocking in the meantime
-    my $matched = $self->SUPER::metadata_read($pluginfo, $base_dir, $file, 
+    my $matched = $self->SUPER::metadata_read($pluginfo, $base_dir, $file,
+					      $block_hash, 
 					      $metadata, $extrametakeys, 
 					      $extrametadata, $processor, 
@@ -192,11 +193,11 @@
 sub read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
     my $outhandle = $self->{'outhandle'};
     my $verbosity = $self->{'verbosity'};
 
-    #check process and block exps, smart block, etc
-    my ($block_status,$filename) = $self->read_block(@_);    
-    return $block_status if ((!defined $block_status) || ($block_status==0));
+    # can we process this file??
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
+    return undef unless $self->can_process_this_file($filename_full_path);
 
     $file =~ s/^[\/\\]+//; # $file often begins with / so we'll tidy it up
@@ -232,5 +233,5 @@
 
 	# create a new document
-	my $doc_obj = new doc ($filename, "indexed_doc");
+	my $doc_obj = new doc ($filename_full_path, "indexed_doc");
 	$doc_obj->set_OIDtype ($processor->{'OIDtype'}, $processor->{'OIDmetadata'});
 	$doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "Language", $language);
@@ -240,5 +241,5 @@
 	$doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "SourceSegment", "$segment");
 	if ($self->{'cover_image'}) {
-	    $self->associate_cover_image($doc_obj, $filename);
+	    $self->associate_cover_image($doc_obj, $filename_full_path);
 	}
 	$doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "Plugin", "$self->{'plugin_type'}");
Index: /gsdl/trunk/perllib/plugins/UnknownPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/UnknownPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/UnknownPlugin.pm	(revision 16392)
@@ -122,5 +122,5 @@
     my ($pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
 
-    my ($filename_full_path, $filename_no_path) = $self->get_full_filenames($base_dir, $file);
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
     my $outhandle = $self->{'outhandle'};
     my $verbosity = $self->{'verbosity'};
Index: /gsdl/trunk/perllib/plugins/W3ImagePlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/W3ImagePlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/W3ImagePlugin.pm	(revision 16392)
@@ -395,8 +395,8 @@
 # include directories
 sub read {
-    my ($self, $pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = (@_);
+    my ($self, $pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = (@_);
     my ($doc_obj, $section, $filepath, $imgtag, $pos, $context, $numdocs, $tndir, $imgs);
     # forward normal read (runs HTMLPlugin if index_pages T)
-    my $ok =  $self->SUPER::read($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli); 
+    my $ok =  $self->SUPER::read($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli); 
     if ( ! $ok ) { return $ok } # what is this returning??
 
Index: /gsdl/trunk/perllib/plugins/ZIPPlugin.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/ZIPPlugin.pm	(revision 16391)
+++ /gsdl/trunk/perllib/plugins/ZIPPlugin.pm	(revision 16392)
@@ -101,16 +101,15 @@
 sub read {
     my $self = shift (@_);
-    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
+    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
     my $outhandle = $self->{'outhandle'};
 
-    # check process_exp, block_exp, associate_ext etc
-    my ($block_status,$filename) = $self->read_block(@_);    
-    return $block_status if ((!defined $block_status) || ($block_status==0));
+    # can we process this file??
+    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
+    return undef unless $self->can_process_this_file($filename_full_path);
 	
-    my ($file_only) = $file =~ /([^\\\/]*)$/;
     my $tmpdir = &util::get_tmp_filename ();
     &util::mk_all_dir ($tmpdir);
     
-    print $outhandle "ZIPPlugin: extracting $file_only to $tmpdir\n"
+    print $outhandle "ZIPPlugin: extracting $filename_no_path to $tmpdir\n"
 	if $self->{'verbosity'} > 1;
     
@@ -118,21 +117,21 @@
     my $cwd = cwd();
     chdir ($tmpdir) || die "Unable to change to $tmpdir";
-    &util::cp ($filename, $tmpdir);
+    &util::cp ($filename_full_path, $tmpdir);
     
     if ($file =~ /\.bz$/i) {
-	$self->bunzip ($file_only);
+	$self->bunzip ($filename_no_path);
     } elsif ($file =~ /\.bz2$/i) {
-	$self->bunzip2 ($file_only);
+	$self->bunzip2 ($filename_no_path);
     } elsif ($file =~ /\.(zip|jar)$/i) {
-	$self->unzip ($file_only);
+	$self->unzip ($filename_no_path);
     } elsif ($file =~ /\.tar$/i) {
-	$self->untar ($file_only);
+	$self->untar ($filename_no_path);
     } else {
-	$self->gunzip ($file_only);
+	$self->gunzip ($filename_no_path);
     }
     
     chdir ($cwd) || die "Unable to change back to $cwd";
     
-    my $numdocs = &plugin::read ($pluginfo, "", $tmpdir, $metadata, $processor, $maxdocs, $total_count, $gli);
+    my $numdocs = &plugin::read ($pluginfo, "", $tmpdir, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli);
     &util::rm_r ($tmpdir);
     
