Changeset 9584


Ignore:
Timestamp:
2005-04-07T15:01:06+12:00 (19 years ago)
Author:
mdewsnip
Message:

Plugins that return -1 from their read function now must output the ProcessingError tag (when in GLI mode) themselves, rather than having it done in plugin.pm. This is so a reason "r='...'" can be optionally included as to why the processing failed.

Location:
trunk/gsdl/perllib
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugin.pm

    r8515 r9584  
    193193            # an error has occurred
    194194        $had_error = 1;
    195         print STDERR "<ProcessingError n='$glifile'>\n" if $gli;
    196195        } else {
    197196            return $rv;
  • trunk/gsdl/perllib/plugins/BasPlug.pm

    r9413 r9584  
    739739    $text = '';
    740740    undef $text;
     741    print STDERR "<ProcessingError n='$file'>\n" if ($gli);
    741742    return -1;
    742743    }
  • trunk/gsdl/perllib/plugins/ConvertToPlug.pm

    r9465 r9584  
    337337    $self->extra_metadata ($doc_obj, $doc_obj->get_top_section(), $metadata);
    338338    # do plugin specific processing of doc_obj
    339     return -1 unless defined ($self->process (\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli ));
     339    unless (defined ($self->process(\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli))) {
     340    print STDERR "<ProcessingError n='$file'>\n" if ($gli);
     341    return -1;
     342    }
    340343    # do any automatic metadata extraction
    341344    $self->auto_extract_metadata ($doc_obj);
  • trunk/gsdl/perllib/plugins/ConvertToRogPlug.pm

    r8166 r9584  
    416416    $self->extra_metadata ($doc_obj, $doc_obj->get_top_section(), $metadata);
    417417    # do plugin specific processing of doc_obj
    418     return -1 unless defined ($self->process (\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj));
     418    unless (defined ($self->process(\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj))) {
     419    print STDERR "<ProcessingError n='$file'>\n" if ($gli);
     420    return -1;
     421    }
    419422    # do any automatic metadata extraction
    420423    $self->auto_extract_metadata ($doc_obj);
  • trunk/gsdl/perllib/plugins/FOXPlug.pm

    r8166 r9584  
    8686    # open the file
    8787    if (!open (FOXBASEIN, $fullname)) {
    88     print STDERR "FOXPlug::read - couldn't read $fullname\n";
     88    if ($gli) {
     89        print STDERR "<ProcessingError n='$file' r='Could not read $fullname'>\n";
     90    }
     91    else {
     92        print STDERR "FOXPlug::read - couldn't read $fullname\n";
     93    }
    8994    return -1; # error in processing
    9095    }
     
    99104    # read in information about dbt file
    100105    if (read (FOXBASEIN, $temp, 32) < 32) {
    101     print STDERR "FOXPlug::read - eof while reading database header";
     106    if ($gli) {
     107        print STDERR "<ProcessingError n='$file' r='EOF while reading database header'>\n";
     108    }
     109    else {
     110        print STDERR "FOXPlug::read - eof while reading database header\n";
     111    }
    102112    close (FOXBASEIN);
    103113    return -1;
     
    116126    $dbf{'hasdbt'} = 0;
    117127    } else {
    118     print STDERR "FOXPlug:read $fullname doesn't seem to be a Foxbase file\n";
     128    if ($gli) {
     129        print STDERR "<ProcessingError n='$file' r='Does not seem to be a Foxbase file'>\n";
     130    }
     131    else {
     132        print STDERR "FOXPlug:read - $fullname doesn't seem to be a Foxbase file\n";
     133    }
    119134    return -1;
    120135    }
     
    145160    }
    146161    if ($dbf{'hasdbt'} && !open (DBTIN, $dbtfullname)) {
    147     print STDERR "FOXPlug::read - couldn't read $dbtfullname\n";
     162    if ($gli) {
     163        print STDERR "<ProcessingError n='$file' r='Could not read $dbtfullname'>\n";
     164    }
     165    else {
     166        print STDERR "FOXPlug::read - couldn't read $dbtfullname\n";
     167    }
    148168    close (FOXBASEIN);
    149169    return -1;
  • trunk/gsdl/perllib/plugins/GMLPlug.pm

    r8121 r9584  
    9393
    9494    if (!open (INFILE, $filename)) {
    95     print $outhandle "GMLPlug::read - couldn't read $filename\n";
     95    if ($gli) {
     96        print STDERR "<ProcessingError n='$file' r='Could not read $filename'>\n";
     97    }
     98    else {
     99        print $outhandle "GMLPlug::read - couldn't read $filename\n";
     100    }
    96101    return -1;
    97102    }
  • trunk/gsdl/perllib/plugins/NULPlug.pm

    r9044 r9584  
    126126   
    127127    # do plugin specific processing of doc_obj
    128     return -1 unless defined ($self->process (\$text, $pluginfo, $base_dir,
    129                          $file, $metadata, $doc_obj));
     128    unless (defined ($self->process(\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj))) {
     129    print STDERR "<ProcessingError n='$file'>\n" if ($gli);
     130    return -1;
     131    }
    130132
    131133    # do any automatic metadata extraction
  • trunk/gsdl/perllib/plugins/OAIPlug.pm

    r9352 r9584  
    152152
    153153    # do plugin specific processing of doc_obj
    154     return -1 unless defined ($self->process (\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj));
     154    unless (defined ($self->process(\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj))) {
     155        print STDERR "<ProcessingError n='$file'>\n" if ($gli);
     156        return -1;
     157    }
    155158
    156159    # do any automatic metadata extraction
  • trunk/gsdl/perllib/plugins/PagedImgPlug.pm

    r9466 r9584  
    548548
    549549    # do plugin specific processing of doc_obj
    550     return -1 unless defined ($self->process (\$text, $pluginfo, $base_dir,
    551                          $file, $metadata, $doc_obj));
     550    unless (defined ($self->process(\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj))) {
     551    print STDERR "<ProcessingError n='$file'>\n" if ($gli);
     552    return -1;
     553    }
    552554
    553555    # do any automatic metadata extraction
  • trunk/gsdl/perllib/plugins/RecPlug.pm

    r9462 r9584  
    235235    # find all the files in the directory
    236236    if (!opendir (DIR, $dirname)) {
    237     print $outhandle "RecPlug: WARNING - couldn't read directory $dirname\n";
     237    if ($gli) {
     238        print STDERR "<ProcessingError n='$file' r='Could not read directory $dirname'>\n";
     239    }
     240    else {
     241        print $outhandle "RecPlug: WARNING - couldn't read directory $dirname\n";
     242    }
    238243    return -1; # error in processing
    239244    }
  • trunk/gsdl/perllib/plugins/UnknownPlug.pm

    r9427 r9584  
    202202    if (associate_unknown_file($self, $filename, $file, $doc_obj) != 1)
    203203    {
    204     print "UnknownPlug: couldn't process \"$filename\"\n";
     204    if ($gli) {
     205        print STDERR "<ProcessingError n='$file'>\n";
     206    }
     207    else {
     208        print $outhandle "UnknownPlug: couldn't process \"$filename\"\n";
     209    }
    205210    return -1; # error during processing
    206211    }
     
    216221
    217222    # do plugin specific processing of doc_obj
    218     return -1 unless defined ($self->process (\$text, $pluginfo, $base_dir,
    219                          $file, $metadata, $doc_obj));
     223    unless (defined ($self->process(\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj))) {
     224    print STDERR "<ProcessingError n='$file'>\n" if ($gli);
     225    return -1;
     226    }
    220227
    221228    # do any automatic metadata extraction
  • trunk/gsdl/perllib/plugins/XMLPlug.pm

    r9466 r9584  
    123123    # reset ourself for the next document
    124124    $self->{'section_level'}=0;
     125    print STDERR "<ProcessingError n='$file'>\n" if ($gli);
    125126    return -1; # error during processing
    126127    }
Note: See TracChangeset for help on using the changeset viewer.