Changeset 1239


Ignore:
Timestamp:
2000-06-26T14:28:03+12:00 (24 years ago)
Author:
gwp
Message:

Replaced references to @_ in subroutine parse with a new variable @rest
because it was not working on kahikatea (perl 5.004).

File:
1 edited

Legend:

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

    r1225 r1239  
    6464# Returns 0 if there was an error, nonzero otherwise.
    6565#
    66 sub parse
     66
     67 
     68 sub parse
    6769{
    6870    my $arglist = shift;
     
    7072    my %option;
    7173
     74<<<<<<< parsargv.pm
     75    my @rest = @_;
     76
     77    # if the last argument is the string "allow_extra_options" then options
     78    # in \@rest without a corresponding SPEC will be ignored (i.e. the "$arg is
     79    # not a valid option" error won't occur)\n";
     80    my $allow_extra_options = pop @rest;
     81    if (defined ($allow_extra_options)) {
     82    if ($allow_extra_options eq "allow_extra_options") {
     83        $allow_extra_options = 1;
     84    } else {
     85        # put it back where we got it
     86        push (@rest, $allow_extra_options);
     87        $allow_extra_options = 0;
     88    }
     89    } else {
     90    $allow_extra_options = 0;
     91    }
     92
     93    while (($spec, $var) = splice(@rest, 0, 2))
     94        {
     95=======
    7296    # if the last argument is the string "allow_extra_options" then options
    7397    # in \@_ without a corresponding SPEC will be ignored (i.e. the "$arg is
     
    88112    while (($spec, $var) = splice(@_, 0, 2))
    89113    {
     114>>>>>>> 1.3
    90115    die "Variable for $spec is not a valid type."
    91116        unless ref($var) eq 'SCALAR' || ref($var) eq 'ARRAY';
Note: See TracChangeset for help on using the changeset viewer.