diff options
author | Norbert Preining <preining@logic.at> | 2011-09-03 11:38:30 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2011-09-03 11:38:30 +0000 |
commit | b0cd7338658b0d52e9dd5b449fc3f36a48e95f02 (patch) | |
tree | 4a6bca859a6e357b455953516b11141ff4271512 | |
parent | e34c0cab18e84d0d01e8178ee2f4bf717b9e6047 (diff) |
work around missing =s{1,2} specification in old perls
git-svn-id: svn://tug.org/texlive/trunk@23776 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/tlpkg/dev/multi-updmap.pl | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/Master/tlpkg/dev/multi-updmap.pl b/Master/tlpkg/dev/multi-updmap.pl index 9704570bad9..a56b611e2a0 100644 --- a/Master/tlpkg/dev/multi-updmap.pl +++ b/Master/tlpkg/dev/multi-updmap.pl @@ -9,7 +9,7 @@ # Original shell script (C) 2002 Thomas Esser # first perl variant (C) Fabrice Popineau # later adaptions by Reinhard Kotucha and Karl Berry -# the original version were licensed under the following agreement: +# the original versions were licensed under the following agreement: # Anyone may freely use, modify, and/or distribute this file, without # limitation. # @@ -810,11 +810,36 @@ sub locateMap { sub processOptions { # first process the stupid setoption= s@{1,2} which is not accepted my $oldconfig = Getopt::Long::Configure(qw(pass_through)); - my @setoptions; - my @enable; - GetOptions("setoption=s{1,2}" => \@setoptions, - "enable=s{1,2}" => \@enable) or + our @setoptions; + our @enable; + #GetOptions("setoption=s{1,2}" => \@setoptions, + # "enable=s{1,2}" => \@enable) or + # die "Try \"$prg --help\" for more information.\n"; + + # try to work around missing s{1,2} support in older perls + sub read_one_or_two { + my ($opt, $val) = @_; + our @setoptions; + our @enable; + # check if = occirs in $val, if not, get the next argument + if ($val =~ m/=/) { + if ($opt eq "setoption") { + push @setoptions, $val; + } else { + push @enable, $val; + } + } else { + if ($opt eq "setoption") { + push @setoptions, "$val=" . shift @ARGV; + } else { + push @enable, "$val=" . shift @ARGV; + } + } + } + GetOptions("setoption=s@" => \&read_one_or_two, + "enable=s@" => \&read_one_or_two) or die "Try \"$prg --help\" for more information.\n"; + Getopt::Long::Configure($oldconfig); # now revamp the @setoptions that they have the proper style |