Index: /main/trunk/greenstone2/perllib/plugins/AutoloadConverterScripting.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/AutoloadConverterScripting.pm	(revision 22704)
+++ /main/trunk/greenstone2/perllib/plugins/AutoloadConverterScripting.pm	(revision 22705)
@@ -73,7 +73,7 @@
 
 ####
-# This plugin takes an extra initial parameter in its constructor (compared with
-#   the norm).  The extra parameter specifies which plugin it should try to
-#   dynamically load
+# This plugin takes an extra initial parameter in its constructor (compared 
+#   with the norm).  The extra parameter specifies which plugin it should 
+#   try to dynamically load
 #####
 
@@ -87,9 +87,8 @@
     my $autoVar  = $dynamic_self->{'_autoVar'};
 
-#    print STDERR "**** autoload NEW autoVar = $dynamic_self->{'_autoVar'}\n";
-#    print STDERR "**** working ", $dynamic_self->{'scripting_ext_working} , "\n";
+    if ($dynamic_self->{'scripting_ext_installed'}) {
+	my ($cpackage,$cfilename,$cline,$csubr,$chas_args,$cwantarray) = caller(0);
 
-    if ($dynamic_self->{'scripting_ext_installed'}) {
-	print STDERR "$class: $autoName Extension to Greenstone detected\n";
+	print STDERR "$class: $autoName Extension to Greenstone detected for $cpackage\n";
 	if ($dynamic_self->{'scripting_ext_working'}) {
 	    # print STDERR "... and it appears to be working\n";
Index: /main/trunk/greenstone2/perllib/plugins/BasePlugin.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/BasePlugin.pm	(revision 22704)
+++ /main/trunk/greenstone2/perllib/plugins/BasePlugin.pm	(revision 22705)
@@ -655,6 +655,7 @@
     my ($filemeta) = @_;
 
-    # analyse filenames without extensions and digits (and trimmed of surrounding 
-    # whitespace), so that irrelevant chars don't confuse textcat
+    # analyse filenames without extensions and digits (and trimmed of
+    # surrounding whitespace), so that irrelevant chars don't confuse
+    # textcat
     my $strictfilemeta = $filemeta;
     $strictfilemeta =~ s/\.[^\.]+$//g;
@@ -1031,5 +1032,5 @@
     my $file_derived_title = $file;
     $file_derived_title =~ s/_/ /g;
-    $file_derived_title =~ s/\..*?$//;
+    $file_derived_title =~ s/\.[^.]$//;
 
     return $file_derived_title;
@@ -1042,5 +1043,6 @@
     my ($doc_obj,$section,$file) = @_;
 
-    if (!defined $doc_obj->get_metadata_element ($section, "Title") or $doc_obj->get_metadata_element($section, "Title") eq "") {
+    if (!defined $doc_obj->get_metadata_element ($section, "Title") 
+	or $doc_obj->get_metadata_element($section, "Title") eq "") {
 
 	my $file_derived_title = $self->filename_to_utf8_metadata($self->filename_based_title($file));
Index: /main/trunk/greenstone2/perllib/plugins/ExcelPlugin.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/ExcelPlugin.pm	(revision 22704)
+++ /main/trunk/greenstone2/perllib/plugins/ExcelPlugin.pm	(revision 22705)
@@ -28,5 +28,4 @@
 package ExcelPlugin;
 
-use OOConvertBinaryFile;
 use strict;
 no strict 'refs'; # allow filehandles to be variables and viceversa
@@ -34,7 +33,8 @@
 use gsprintf 'gsprintf';
 
-sub BEGIN {
-    @ExcelPlugin::ISA = ('OOConvertBinaryFile');
-}
+use AutoloadConverterScripting;
+
+@ExcelPlugin::ISA = ('AutoloadConverterScripting');
+
 
 my $arguments = 
@@ -61,5 +61,5 @@
     push(@{$hashArgOptLists->{"OptList"}},$options);
 
-    my $self = new OOConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists);
+    my $self = new AutoloadConverterScripting("OpenOfficeConverter",$pluginlist, $inputargs, $hashArgOptLists);
     
     if ($self->{'info_only'}) {
Index: in/trunk/greenstone2/perllib/plugins/OOConvertBinaryFile.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/OOConvertBinaryFile.pm	(revision 22704)
+++ 	(revision )
@@ -1,141 +1,0 @@
-package OOConvertBinaryFile;
-
-use ConvertBinaryFile;
-
-
-use gsprintf 'gsprintf';
-# @ISA dynamically configured to be either OpenOfficeConverter or ConvertBinaryFile
-
-# do not initialise these variables
-my $openoffice_ext_installed;
-my $openoffice_ext_working;
-sub BEGIN {
-    eval("require OpenOfficeConverter");
-    if ($@) {
-	# Useful debugging statement if there is a syntax error in OpenOfficeConverter:
-	# print STDERR "$@\n";
-	$openoffice_ext_installed = 0;
-	$openoffice_ext_working = 0;
-    }
-    else {
-	# Successfully found
-	$openoffice_ext_installed = 1;
-	# now check whether it can run soffice
-	if ($OpenOfficeConverter::openoffice_conversion_available) {
-	    $openoffice_ext_working = 1;
-	    
-	} else {
-	    $openoffice_ext_working = 0;
-	}
-    }
-
-    if ($openoffice_ext_working) {
-	@OOConvertBinaryFile::ISA = ('ConvertBinaryFile', 'OpenOfficeConverter');
-    } else {
-	@OOConvertBinaryFile::ISA = ('ConvertBinaryFile');
-    }
-}
-
-my $opt_openoffice_args = 
-    [ { 'name' => "openoffice_scripting",
-	'desc' => "{OpenOfficeConverter.openoffice_scripting}",
-	'type' => "flag",
-	'reqd' => "no" } ];
-
-my $arguments = [];
-
-my $options = { 'name'     => "OOConvertBinaryFile",
-		'desc'     => "{OOConvertBinaryFile.desc}",
-		'abstract' => "yes",
-		'inherits' => "yes",
-		'args'     => $arguments };
-
-sub new {
-    my ($class) = shift (@_);
-    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
-    push(@$pluginlist, $class);
-
-    if ($openoffice_ext_installed) {
-	print STDERR "$class: OpenOffice Extension to Greenstone detected\n";
-	if ($openoffice_ext_working) {
-	    print STDERR "... and it appears to be working\n";
-	} else {
-	    print STDERR "... but it appears to be broken\n";
-	    &gsprintf(STDERR, "OpenOfficeConverter: {OpenOfficeConverter.noconversionavailable} ({OpenOfficeConverter.$OpenOfficeConverter::no_openoffice_conversion_reason})\n");
-	}
-    }
-
-    if ($openoffice_ext_working) {
-	push(@$arguments,@$opt_openoffice_args);
-    }
-
-    push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
-    push(@{$hashArgOptLists->{"OptList"}},$options);
-
-    if ($openoffice_ext_working) {
-	
-	#$self = new OpenOfficeConverter($pluginlist, $inputargs, $hashArgOptLists);
-	my $ooc_self = new OpenOfficeConverter($pluginlist, $inputargs, $hashArgOptLists);
-	my $cbf_self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists);
-	$self = BasePlugin::merge_inheritance($ooc_self, $cbf_self);
-	$self->{'openoffice_available'} = 1;
-    }
-    else {
-	$self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists);
-	$self->{'openoffice_available'} = 0;
-   }
-
-#    if ($self->{'info_only'}) {
-	# don't worry about any options etc
-	return bless $self, $class;
-#    }
-}
-
-sub init {
-    my $self = shift (@_);
-    my ($verbosity, $outhandle, $failhandle) = @_;
-    
-    $self->SUPER::init($verbosity,$outhandle,$failhandle);
-    if ($openoffice_ext_working) {
-	$self->OpenOfficeConverter::init();
-    }
-}
-
-sub begin {
-    my $self = shift (@_);
-
-    if ($openoffice_ext_working) {
-	$self->OpenOfficeConverter::begin(@_);
-    }
-    $self->SUPER::begin(@_);
-}
-
-sub deinit {
-    # called only once, after all plugin passes have been done
-    my ($self) = @_;
-    
-    if ($openoffice_ext_working) {
-	$self->OpenOfficeConverter::deinit();
-    }
-    $self->SUPER::deinit();
-}
-
-# if we are using open office, we use OpenOfficeConverter's convert method, otherwise fall back to ConvertBinaryFile method.
-sub tmp_area_convert_file {
-    my $self = shift (@_);
-    my ($output_ext, $input_filename, $textref) = @_;
-
-    if ($openoffice_ext_working && $self->{'openoffice_scripting'}) {
-	my ($result, $result_str, $new_filename) = $self->OpenOfficeConverter::convert($input_filename, $output_ext);
-	if ($result != 0) {
-	    return $new_filename;
-	}
-	my $outhandle=$self->{'outhandle'};
-	print $outhandle "Open Office Conversion error\n";
-	print $outhandle $result_str;
-	return "";
-    }
-    else {
-	return $self->ConvertBinaryFile::tmp_area_convert_file(@_);
-    }
-}
Index: in/trunk/greenstone2/perllib/plugins/PBConvertBinaryFile.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/PBConvertBinaryFile.pm	(revision 22704)
+++ 	(revision )
@@ -1,147 +1,0 @@
-package PBConvertBinaryFile;
-
-use ConvertBinaryFile;
-
-# ****
-# Look into making a shared base class that does the same, but is parameterized
-# on the name of the actual extension.  
-#
-# i.e. this file is the same as OOConvertBinaryFile with the following substitutions
-#
-#OO -> PB
-#OpenOffice -> PDFBox
-#openoffice -> pdfbox
-#Open Office Conversion-> PDFBox Conversion
-
-use gsprintf 'gsprintf';
-# @ISA dynamically configured to be either PDFBoxConverter or ConvertBinaryFile
-
-# do not initialise these variables
-my $pdfbox_ext_installed;
-my $pdfbox_ext_working;
-sub BEGIN {
-    eval("require PDFBoxConverter");
-    if ($@) {
-	# Useful debugging statement if there is a syntax error in PDFBoxConverter:
-	# print STDERR "$@\n";
-	$pdfbox_ext_installed = 0;
-	$pdfbox_ext_working = 0;
-    }
-    else {
-	# Successfully found
-	$pdfbox_ext_installed = 1;
-	# now check whether it can run soffice
-	if ($PDFBoxConverter::pdfbox_conversion_available) {
-	    $pdfbox_ext_working = 1;
-	    
-	} else {
-	    $pdfbox_ext_working = 0;
-	}
-    }
-
-    if ($pdfbox_ext_working) {
-	@PBConvertBinaryFile::ISA = ('ConvertBinaryFile', 'PDFBoxConverter');
-    } else {
-	@PBConvertBinaryFile::ISA = ('ConvertBinaryFile');
-    }
-}
-
-my $opt_pdfbox_args = 
-    [ { 'name' => "pdfbox_scripting",
-	'desc' => "{PDFBoxConverter.pdfbox_scripting}",
-	'type' => "flag",
-	'reqd' => "no" } ];
-
-my $arguments = [];
-
-my $options = { 'name'     => "PBConvertBinaryFile",
-		'desc'     => "{PBConvertBinaryFile.desc}",
-		'abstract' => "yes",
-		'inherits' => "yes",
-		'args'     => $arguments };
-
-sub new {
-    my ($class) = shift (@_);
-    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
-    push(@$pluginlist, $class);
-
-    if ($pdfbox_ext_installed) {
-	print STDERR "$class: PDFBox Extension to Greenstone detected\n";
-	if (! $pdfbox_ext_working) {
-	    print STDERR "... but it appears to be broken\n";
-	    &gsprintf(STDERR, "PDFBoxConverter: {PDFBoxConverter.noconversionavailable} ({PDFBoxConverter.$PDFBoxConverter::no_pdfbox_conversion_reason})\n");
-	}
-    }
-
-    if ($pdfbox_ext_working) {
-	push(@$arguments,@$opt_pdfbox_args);
-    }
-
-    push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
-    push(@{$hashArgOptLists->{"OptList"}},$options);
-
-    if ($pdfbox_ext_working) {
-	
-	my $ooc_self = new PDFBoxConverter($pluginlist, $inputargs, $hashArgOptLists,1);
-	my $cbf_self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists);
-	$self = BasePlugin::merge_inheritance($ooc_self, $cbf_self);
-	$self->{'pdfbox_available'} = 1;
-    }
-    else {
-	$self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists);
-	$self->{'pdfbox_available'} = 0;
-   }
-
-    return bless $self, $class;
-
-}
-
-
-sub init {
-    my $self = shift (@_);
-    my ($verbosity, $outhandle, $failhandle) = @_;
-    
-    $self->SUPER::init($verbosity,$outhandle,$failhandle);
-    if ($pdfbox_ext_working) {
-	$self->PDFBoxConverter::init();
-    }
-}
-
-sub begin {
-    my $self = shift (@_);
-
-    if ($pdfbox_ext_working) {
-	$self->PDFBoxConverter::begin(@_);
-    }
-    $self->SUPER::begin(@_);
-}
-
-sub deinit {
-    # called only once, after all plugin passes have been done
-    my ($self) = @_;
-    
-    if ($pdfbox_ext_working) {
-	$self->PDFBoxConverter::deinit();
-    }
-    $self->SUPER::deinit();
-}
-
-# if we are using open office, we use PDFBoxConverter's convert method, otherwise fall back to ConvertBinaryFile method.
-sub tmp_area_convert_file {
-    my $self = shift (@_);
-    my ($output_ext, $input_filename, $textref) = @_;
-
-    if ($pdfbox_ext_working && $self->{'pdfbox_scripting'}) {
-	my ($result, $result_str, $new_filename) = $self->PDFBoxConverter::convert($input_filename, $output_ext);
-	if ($result != 0) {
-	    return $new_filename;
-	}
-	my $outhandle=$self->{'outhandle'};
-	print $outhandle "PDFBox Conversion error\n";
-	print $outhandle $result_str;
-	return "";
-    }
-    else {
-	return $self->ConvertBinaryFile::tmp_area_convert_file(@_);
-    }
-}
Index: /main/trunk/greenstone2/perllib/plugins/PDFPlugin.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/PDFPlugin.pm	(revision 22704)
+++ /main/trunk/greenstone2/perllib/plugins/PDFPlugin.pm	(revision 22705)
@@ -25,15 +25,14 @@
 package PDFPlugin;
 
+use strict;
+no strict 'refs'; # so we can use a var for filehandles (e.g. STDERR)
+
 use ReadTextFile;
 use unicode;
-use strict;
-no strict 'refs'; # so we can use a var for filehandles (e.g. STDERR)
-
-sub BEGIN {
-    $::autoloadConverterScripting="PDFBoxConverter";
-    require AutoloadConverterScripting;
-
-    @PDFPlugin::ISA = ('AutoloadConverterScripting', 'ReadTextFile');
-}
+
+use AutoloadConverterScripting;
+
+@PDFPlugin::ISA = ('AutoloadConverterScripting', 'ReadTextFile');
+
 
 my $convert_to_list =
Index: /main/trunk/greenstone2/perllib/plugins/PowerPointPlugin.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/PowerPointPlugin.pm	(revision 22704)
+++ /main/trunk/greenstone2/perllib/plugins/PowerPointPlugin.pm	(revision 22705)
@@ -28,14 +28,14 @@
 package PowerPointPlugin;
 
-use OOConvertBinaryFile;
-
 use strict;
 no strict 'refs'; # allow filehandles to be variables and viceversa
 no strict 'subs';
+
 use gsprintf 'gsprintf';
 
-sub BEGIN {
-    @PowerPointPlugin::ISA = ('OOConvertBinaryFile');
-}
+use AutoloadConverterScripting;
+
+@PowerPointPlugin::ISA = ('AutoloadConverterScripting');
+
 
 my $windows_convert_to_list =
@@ -95,5 +95,8 @@
 
 
-    my $self = new OOConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists);
+    my $self 
+	= new AutoloadConverterScripting("OpenOfficeConverter",
+					 $pluginlist, $inputargs, 
+					 $hashArgOptLists);
  
     if ($self->{'info_only'}) {
Index: /main/trunk/greenstone2/perllib/plugins/WordPlugin.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/WordPlugin.pm	(revision 22704)
+++ /main/trunk/greenstone2/perllib/plugins/WordPlugin.pm	(revision 22705)
@@ -31,10 +31,8 @@
 use gsprintf 'gsprintf';
 
-sub BEGIN {
-    $::autoloadConverterScripting="OpenOfficeConverter";
-    require AutoloadConverterScripting;
-
-    @WordPlugin::ISA = ('AutoloadConverterScripting');
-}
+use AutoloadConverterScripting;
+
+@WordPlugin::ISA = ('AutoloadConverterScripting');
+
 
 my $arguments =
