Changeset 10229


Ignore:
Timestamp:
2005-07-08T09:56:37+12:00 (19 years ago)
Author:
kjdon
Message:

fixed up some stuff for printing args (pluginfo.pl, classinfo.pl)

Location:
trunk/gsdl/perllib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/classify/BasClas.pm

    r10223 r10229  
    5353# 28/11/03 Commented out verbosity argument - John Thompson
    5454
    55 use parsargv;
     55#use parsargv;
    5656use gsprintf;
    5757use printusage;
    5858use parse2;
     59
     60# suppress the annoying "subroutine redefined" warning that various
     61# classifiers cause under perl 5.6
     62$SIG{__WARN__} = sub {warn($_[0]) unless ($_[0] =~ /Subroutine\s+\S+\sredefined/)};
     63
     64use strict;
     65no strict 'subs'; # allow barewords (eg STDERR) as function arguments
    5966
    6067my $arguments =
     
    109116    my $optionlistref = $self->{'option_list'};
    110117    my @optionlist = @$optionlistref;
    111     my $classifieroptions = pop(@$optionlistref);
     118    my $classifieroptions = shift(@$optionlistref);
    112119    return if (!defined($classifieroptions));
    113120
     
    177184    my $optionlistref = $self->{'option_list'};
    178185    my @optionlist = @$optionlistref;
    179     my $classifieroptions = pop(@$optionlistref);
     186    my $classifieroptions = shift(@$optionlistref);
    180187    return if (!defined($classifieroptions));
    181188
     
    216223sub new {
    217224    my ($class) = shift (@_);
    218     my ($classifierslist,$args,,$hashArgOptLists) = @_;
     225    my ($classifierslist,$args,$hashArgOptLists) = @_;
    219226    push(@$classifierslist, $class);
    220227    my $classifier_name = (defined $classifierslist->[0]) ? $classifierslist->[0] : $class;
     
    231238    $self->{"info_only"} = 0;
    232239
    233     # Check if gsdlinfo is in the argument list or not. 
    234     foreach $strArg (@{$args})
     240    # Check if gsdlinfo is in the argument list or not - if it is, don't parse
     241    # the args, just return the object. 
     242    foreach my $strArg (@{$args})
    235243    {
    236     if($strArg eq "gsdlinfo")
     244    if($strArg eq "-gsdlinfo")
    237245    {
    238246        $self->{"info_only"} = 1;
    239         last;
    240     }
    241     }
    242 
    243     # If gsdlinfo is not in the argument list, process the argument normally.
    244     if($self->{"info_only"} == 0)
     247        return bless $self, $class;
     248    }
     249    }
     250
     251    # general options available to all classifiers
     252    if(!parse2::parse($args,$hashArgOptLists->{"ArgList"},$self))
    245253    {
    246     my $blnParseFailed = "false";
    247     # general options available to all plugins
    248     if(!parse2::parse($args,$hashArgOptLists->{"ArgList"},$self))
    249     {
    250         $blnParseFailed = "true";
    251     }
    252    
    253     # If the parsing wasn't successful, then print out the text usage of this classifier.
     254    #print out the text usage of this classifier.
    254255    my $classTempClass = bless $self, $class;
    255     if($blnParseFailed eq "true")
    256     {
    257         &gsprintf(STDERR, "\n{BasClas.bad_general_option}\n", $classifier_name);
    258         $classTempClass->print_txt_usage("");  # Use default resource bundle
    259         die "\n";
    260     }
    261     else
    262     {
    263         delete $self->{"info_only"};
    264         return $classTempClass;
    265     }
    266     }
    267 
    268     # If gsdlinfo is in the argument list, do not perform any parsing.
    269     else
    270     {   
    271     delete $self->{"info_only"};
    272     return bless $self, $class;
    273     }
     256    &gsprintf(STDERR, "\n{BasClas.bad_general_option}\n", $classifier_name);
     257    $classTempClass->print_txt_usage("");  # Use default resource bundle
     258    die "\n";
     259    }
     260   
     261    delete $self->{"info_only"};
     262    return bless $self, $class;
    274263}
    275264
  • trunk/gsdl/perllib/plugins/BasPlug.pm

    r10218 r10229  
    242242    my $optionlistref = $self->{'option_list'};
    243243    my @optionlist = @$optionlistref;
    244     my $pluginoptions = pop(@$optionlistref);
     244    my $pluginoptions = shift(@$optionlistref);
    245245    return if (!defined($pluginoptions));
    246246
     
    284284    my $optionlistref = $self->{'option_list'};
    285285    my @optionlist = @$optionlistref;
    286     my $pluginoptions = pop(@$optionlistref);
     286    my $pluginoptions = shift(@$optionlistref);
    287287    return $maxoffset if (!defined($pluginoptions));
    288288
     
    311311    my $optionlistref = $self->{'option_list'};
    312312    my @optionlist = @$optionlistref;
    313     my $pluginoptions = pop(@$optionlistref);
     313    my $pluginoptions = shift(@$optionlistref);
    314314    return if (!defined($pluginoptions));
    315315
Note: See TracChangeset for help on using the changeset viewer.