Changeset 10579


Ignore:
Timestamp:
2005-08-29T10:38:07+12:00 (19 years ago)
Author:
kjdon
Message:

copied classify.pm and BasClas.pm, added -gsdlinfo flag - if this is present (it gets set by pluginfo.pl) then don't bother parsing the args - just set up the arg data structures

Location:
trunk/gsdl/perllib
Files:
2 edited

Legend:

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

    r10482 r10579  
    2828use strict; # to pick up typos and undeclared variables...
    2929no strict 'refs'; # ...but allow filehandles to be variables and vice versa
     30no strict 'subs';
    3031
    3132require util;
     
    4243#globaloptions contains any options that should be passed to all plugins
    4344my ($verbosity, $outhandle, $failhandle, $globaloptions);
     45
     46sub load_plugin_for_info {
     47    my ($pluginname) = shift @_;
     48
     49    # find the plugin
     50    my $colplugname = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"perllib/plugins",
     51                      "${pluginname}.pm");
     52    my $mainplugname = &util::filename_cat($ENV{'GSDLHOME'},"perllib/plugins",
     53                       "${pluginname}.pm");
     54    if (-e $colplugname) { require $colplugname; }
     55    elsif (-e $mainplugname) { require $mainplugname; }
     56    else {
     57    &gsprintf(STDERR, "{plugin.could_not_find_plugin}\n",
     58         $pluginname);
     59    die "\n";
     60    }
     61
     62    # create a plugin object
     63    my ($plugobj);
     64    my $options = "-gsdlinfo";
     65   
     66    eval ("\$plugobj = new \$pluginname([],[$options])");
     67    die "$@" if $@;
     68
     69    return $plugobj;
     70}
    4471
    4572sub load_plugins {
  • trunk/gsdl/perllib/plugins/BasPlug.pm

    r10478 r10579  
    381381   
    382382    my $self = {};
     383    $self->{'outhandle'} = STDERR;
     384    $self->{'option_list'} = $hashArgOptLists->{"OptList"};
     385    $self->{"info_only"} = 0;
     386
     387    # Check if gsdlinfo is in the argument list or not - if it is, don't parse
     388    # the args, just return the object. 
     389    foreach my $strArg (@{$args})
     390    {
     391    if($strArg eq "-gsdlinfo")
     392    {
     393        $self->{"info_only"} = 1;
     394        return bless $self, $class;
     395    }
     396    }
     397
    383398    if(!parse2::parse($args,$hashArgOptLists->{"ArgList"},$self))
    384399    {
     
    390405
    391406
     407    delete $self->{"info_only"};
    392408    # else parsing was successful.
    393409
    394410    $self->{'plugin_type'} = $plugin_name;
    395     $self->{'outhandle'} = STDERR;
     411    #$self->{'outhandle'} = STDERR;
    396412    $self->{'textcat'} = new textcat();
    397413    $self->{'num_processed'} = 0;
     
    402418    $self->{'cover_image'} = 0 if ($self->{'no_cover_image'});
    403419    $self->{'file_blocks'} = {};
    404     $self->{'option_list'} = $hashArgOptLists->{"OptList"};
     420    #$self->{'option_list'} = $hashArgOptLists->{"OptList"};
    405421   
    406422    my $associate_ext = $self->{'associate_ext'};
Note: See TracChangeset for help on using the changeset viewer.