Ignore:
Timestamp:
2018-07-27T18:31:59+12:00 (6 years ago)
Author:
ak19
Message:
  1. When a plugin's built on multiple inheritance, the first n-1 internal plugins before merging must allow extra args so that parsing does not fail: need to pass 1 (for true) to the constructors of the first n-1 internal plugins to allow extra args. Correcting both the recent PDFv2Plugin, where Renate had found a bug and Kathy had pointed out this fix, and the earlier UnknownConverterPlugin where I didn't know to add this parameter either. 2. Dr Bainbridge explained why UnknownConverterPlugin's convert_to option need not be manually defined when it was unexpectedly undefined: it being undefined only caused warnings when running pluginfo, and the actual solution was to return sooner from the constructor when in info_only (pluginfo) mode.
File:
1 edited

Legend:

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

    r32303 r32305  
    3131no strict 'subs'; # allow filehandles to be variables and viceversa
    3232
     33use ConvertBinaryFile;
     34use PDFBoxConverter;
    3335use ReadTextFile;
     36
    3437use unicode;
    3538use Mojo::DOM; # for HTML parsing
    3639
    37 use PDFBoxConverter;
    38 use ConvertBinaryFile;
    3940
    4041@PDFv2Plugin::ISA = ('ConvertBinaryFile', 'PDFBoxConverter', 'ReadTextFile');
     
    124125    push(@{$hashArgOptLists->{"OptList"}},$options);
    125126
    126     my $pdfbox_converter_self = new PDFBoxConverter($pluginlist, $inputargs, $hashArgOptLists);
     127    # the 1 at the end of the first constructor call is to allow extra arguments to remain after
     128    # parsing. There should be no extra args after the final constructor call, because all args
     129    # should have been parsed by then, so don't pass 1 to the last constructor.
     130    my $pdfbox_converter_self = new PDFBoxConverter($pluginlist, $inputargs, $hashArgOptLists, 1);
    127131    my $cbf_self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists);
    128132    my $self = BaseImporter::merge_inheritance($pdfbox_converter_self, $cbf_self); # this param order seems necessary to preserve the default/user-selected value for the convert_to option
Note: See TracChangeset for help on using the changeset viewer.