Changeset 22702

Show
Ignore:
Timestamp:
21.08.2010 00:33:16 (9 years ago)
Author:
davidb
Message:

Introduction of new plugin AutoloadConverterScripting? to replace duplicated code that turns up in plugins like OOConvertBinaryFile and PBConvertBinaryFile

Location:
main/trunk/greenstone2/perllib/plugins
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/PDFPlugin.pm

    r22675 r22702  
    2525package PDFPlugin; 
    2626 
    27 use PBConvertBinaryFile; 
    2827use ReadTextFile; 
    2928use unicode; 
    3029use strict; 
    31 no strict 'refs'; # so we can use a var for filehandles (eg STDERR) 
     30no strict 'refs'; # so we can use a var for filehandles (e.g. STDERR) 
    3231 
    3332sub BEGIN { 
    34     @PDFPlugin::ISA = ('PBConvertBinaryFile', 'ReadTextFile'); 
     33    $::autoloadConverterScripting="PDFBoxConverter"; 
     34    require AutoloadConverterScripting; 
     35 
     36    @PDFPlugin::ISA = ('AutoloadConverterScripting', 'ReadTextFile'); 
    3537} 
    3638 
     
    119121    push(@{$hashArgOptLists->{"OptList"}},$options); 
    120122 
    121     my $self = new PBConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists); 
     123    my $self = new AutoloadConverterScripting("PDFBoxConverter",$pluginlist, $inputargs, $hashArgOptLists); 
    122124     
    123125    if ($self->{'info_only'}) { 
     
    147149    } 
    148150    # set convert_to_plugin and convert_to_ext 
    149     $self->PBConvertBinaryFile::set_standard_convert_settings(); 
     151    $self->set_standard_convert_settings(); 
    150152 
    151153    my $secondary_plugin_name = $self->{'convert_to_plugin'}; 
  • main/trunk/greenstone2/perllib/plugins/WordPlugin.pm

    r22641 r22702  
    2525package WordPlugin; 
    2626 
    27 use OOConvertBinaryFile; 
    28  
    29  
    3027use strict; 
    3128no strict 'refs'; # allow filehandles to be variables and viceversa 
    3229no strict 'subs'; 
     30 
    3331use gsprintf 'gsprintf'; 
    3432 
    3533sub BEGIN { 
    36     @WordPlugin::ISA = ('OOConvertBinaryFile'); 
     34    $::autoloadConverterScripting="OpenOfficeConverter"; 
     35    require AutoloadConverterScripting; 
     36 
     37    @WordPlugin::ISA = ('AutoloadConverterScripting'); 
    3738} 
    3839 
     
    106107    $office_capable = 1; 
    107108    } 
    108     if ($OOConvertBinaryFile::openoffice_ext_working) { 
     109    if ($AutoloadConverterScripting::openoffice_ext_working) { 
    109110    $office_capable = 1; 
    110111    } 
     
    117118    push(@{$hashArgOptLists->{"OptList"}},$options); 
    118119 
    119     my $self = new OOConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists); 
     120    my $self = new AutoloadConverterScripting("OpenOfficeConverter",$pluginlist, $inputargs, $hashArgOptLists); 
    120121 
    121122    if ($self->{'info_only'}) { 
     
    210211sub get_default_process_exp { 
    211212    my $self = shift (@_); 
    212     if ($OOConvertBinaryFile::openoffice_ext_working) { 
     213    if ($AutoloadConverterScripting::openoffice_ext_working) { 
    213214    return q^(?i)\.(doc|dot|docx|odt)$^; 
    214215    }