[tcltk-perl] Makefile.PL cleanup [PATCH]
Brought to you by:
hobbs
From: Gisle A. <gi...@Ac...> - 2004-04-14 09:12:45
|
Suggested cleanup patch for Tcl's Makefile.PL. It gets rid of badly handcoded option parsing and replace it with Getopt::Long. Similar patch also makes sense for the Tcl-Tk one. --Gisle Index: Makefile.PL =================================================================== RCS file: /cvsroot/tcltkce/Tcl/Makefile.PL,v retrieving revision 1.3 diff -u -p -u -r1.3 Makefile.PL --- Makefile.PL 9 Apr 2004 19:05:23 -0000 1.3 +++ Makefile.PL 14 Apr 2004 08:52:43 -0000 @@ -1,33 +1,24 @@ +#!/usr/bin/perl -w + # before running this script make sure you have 'tclsh' in your path, # and this 'tcl' distribution is required one. # FreeBSD users may want to modify name of tcl interpreter (this is # $tclsh variable below) as long as 'tclsh' does not work in their case +use strict; +use Getopt::Long qw(GetOptions); + my $tclsh = 'tclsh'; my $tclconfig; my $buildspec; my $libpath; my $incpath; -while (1) { - # Handle any --options - last unless @ARGV[0] =~ /^--/; - my $opt = shift @ARGV; - my $val = shift @ARGV; - if ($opt eq "--tclsh") { - $tclsh = $val; - } - elsif ($opt eq "--tclconfig") { - $tclconfig = $val; - } - elsif ($opt eq "--buildspec") { - $buildspec = 1; - } - else { - die "unknown option '$opt', must be --tclsh, --tclconfig or --buildspec\n"; - } -} - +GetOptions("tclsh=s", \$tclsh, + "tclconfig=s", \$tclconfig, + "buildspec", \$buildspec) + || die "Usage: perl Makefile.PL [--tclsh <path>] [--tclconfig <path>] " . + "[--buildspec] [<makemaker opts>...]\n"; if ($tclconfig) { die "Tcl config file '$tclconfig' not found\n" unless (-f $tclconfig); |