Changeset 1225


Ignore:
Timestamp:
2000-06-21T10:27:17+12:00 (24 years ago)
Author:
sjboddie
Message:

minor change to parsargv.pm to allow for parsing of options within
base class as well as subclass

File:
1 edited

Legend:

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

    r537 r1225  
    7070    my %option;
    7171
     72    # if the last argument is the string "allow_extra_options" then options
     73    # in \@_ without a corresponding SPEC will be ignored (i.e. the "$arg is
     74    # not a valid option" error won't occur)\n";
     75    my $allow_extra_options = pop @_;
     76    if (defined ($allow_extra_options)) {
     77    if ($allow_extra_options eq "allow_extra_options") {
     78        $allow_extra_options = 1;
     79    } else {
     80        # put it back where we got it
     81        push (@_, $allow_extra_options);
     82        $allow_extra_options = 0;
     83    }
     84    } else {
     85    $allow_extra_options = 0;
     86    }
     87
    7288    while (($spec, $var) = splice(@_, 0, 2))
    7389    {
     
    126142        &process_arg($option{$arg}, $arglist, \$errors);
    127143        }
    128         else
     144        elsif (!$allow_extra_options)
    129145        {
    130146        print STDERR "$arg is not a valid option.\n";
Note: See TracChangeset for help on using the changeset viewer.