Ignore:
Timestamp:
2008-06-05T09:29:32+12:00 (16 years ago)
Author:
kjdon
Message:

plugin overhaul: plugins renamed to xxPlugin, and in some cases the names are made more sensible. They now use the new base plugins. Hopefully we have better code reuse. Some of the plugins still need work done as I didn't want to spend another month doing this before committing it. Alos, I haven't really tested anything yet...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/MARCPlugin.pm

    r15865 r15872  
    11###########################################################################
    22#
    3 # MARCPlug.pm -- basic MARC plugin
     3# MARCPlugin.pm -- basic MARC plugin
    44#
    55# A component of the Greenstone digital library software
     
    2525###########################################################################
    2626
    27 package MARCPlug;
    28 
    29 use SplitPlug;
     27package MARCPlugin;
     28
     29use SplitTextFile;
    3030
    3131use unicode;
     
    3636
    3737sub BEGIN {
    38     @MARCPlug::ISA = ('SplitPlug');
     38    @MARCPlugin::ISA = ('SplitTextFile');
    3939    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
    4040}
     
    4242my $arguments =
    4343    [ { 'name' => "metadata_mapping",
    44     'desc' => "{MARCPlug.metadata_mapping}",
     44    'desc' => "{MARCPlugin.metadata_mapping}",
    4545    'type' => "string",
    4646    'deft' => "marctodc.txt",
     
    5353    'reqd' => "no" },
    5454      { 'name' => "process_exp",
    55     'desc' => "{BasPlug.process_exp}",
     55    'desc' => "{BasePlugin.process_exp}",
    5656    'type' => "regexp",
    5757    'reqd' => "no",
    5858    'deft' => &get_default_process_exp() },
    5959      { 'name' => "split_exp",
    60     'desc' => "{SplitPlug.split_exp}",
     60    'desc' => "{SplitTextFile.split_exp}",
    6161    'type' => "regexp",
    6262    'reqd' => "no",
     
    6464      ];
    6565
    66 my $options = { 'name'     => "MARCPlug",
    67         'desc'     => "{MARCPlug.desc}",
     66my $options = { 'name'     => "MARCPlugin",
     67        'desc'     => "{MARCPlugin.desc}",
    6868        'abstract' => "no",
    6969        'inherits' => "yes",
     
    8181    push(@$pluginlist, $class);
    8282
    83     if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
    84     if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
    85 
    86     my $self = new SplitPlug($pluginlist, $inputargs, $hashArgOptLists);
     83    push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
     84    push(@{$hashArgOptLists->{"OptList"}},$options);
     85
     86    my $self = new SplitTextFile($pluginlist, $inputargs, $hashArgOptLists);
    8787
    8888    # 'metadata_mapping' was used in two ways in the plugin: as a plugin
     
    119119    {
    120120
    121     my $msg = "MARCPlug ERROR: Can't locate mapping file \"" .
     121    my $msg = "MARCPlugin ERROR: Can't locate mapping file \"" .
    122122        $self->{'metadata_mapping_file'} . "\".\n" .
    123123        "    No marc files can be processed.\n";
     
    245245        push(@marc_entries,$marc);
    246246    $$textref .= $marc->as_formatted();
    247     $$textref .= "\n\n"; # for SplitPlug - see default_split_exp above...
     247    $$textref .= "\n\n"; # for SplitTextFile - see default_split_exp above...
    248248    }
    249249
     
    254254
    255255# do plugin specific processing of doc_obj
    256 # This gets done for each record found by SplitPlug in marc files.
     256# This gets done for each record found by SplitTextFile in marc files.
    257257sub process {
    258258    my $self = shift (@_);
     
    264264    if (! defined($self->{'metadata_mapping'}))
    265265    {
    266     print $outhandle "MARCPlug: no metadata file! Can't process $file\n";
     266    print $outhandle "MARCPlugin: no metadata file! Can't process $file\n";
    267267    return undef;
    268268    }
    269269
    270     print STDERR "<Processing n='$file' p='MARCPlug'>\n" if ($gli);
    271     print $outhandle "MARCPlug: processing $file\n"
     270    print STDERR "<Processing n='$file' p='MARCPlugin'>\n" if ($gli);
     271    print $outhandle "MARCPlugin: processing $file\n"
    272272    if $self->{'verbosity'} > 1;
    273273
Note: See TracChangeset for help on using the changeset viewer.