>From 8999c441cc78f6501ea3ec6759493da8529fcad8 Mon Sep 17 00:00:00 2001 Message-Id: From: Stefano Lattarini Date: Sun, 15 Jan 2012 09:33:41 +0100 Subject: [PATCH] getopt: avoid perl warning upon incorrect command line usages After the previous change 'v2.68-113-g5bc3e85', incorrect command line usages (like autom4te being called without any argument) might trigger this warning from perl: "Use of uninitialized value $ARGV[0] in pattern match (m//)..." Luckily, the fix is trivial. * lib/Autom4te/General.pm (getopt): Only try to dereference the contents of @ARGV if there truly are arguments left in it. --- ChangeLog | 11 +++++++++++ lib/Autom4te/General.pm | 2 +- 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index c5ccc04..b5af5bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-01-15 Stefano Lattarini + + getopt: avoid perl warning upon incorrect command line usages + After the previous change 'v2.68-113-g5bc3e85', incorrect + command line usages (like autom4te being called without any + argument) triggered this warning from perl: + "Use of uninitialized value $ARGV[0] in pattern match (m//)..." + Luckily, the fix is trivial. + * lib/Autom4te/General.pm (getopt): Only try to dereference the + contents of @ARGV if there truly are arguments left in it. + 2011-01-14 Stefano Lattarini getopt: fix diagnostic for missing mandatory option argument diff --git a/lib/Autom4te/General.pm b/lib/Autom4te/General.pm index 5b48005..1be4f90 100644 --- a/lib/Autom4te/General.pm +++ b/lib/Autom4te/General.pm @@ -270,7 +270,7 @@ sub getopt (%) # FIXME: Lot of code duplication with automake here. It would probably # be best to generalize our getopt() func and rip it out in a new module # from which automake can sync. - if ($ARGV[0] =~ /^-./) + if (@ARGV > 0 && $ARGV[0] =~ /^-./) { my %argopts; for my $k (keys %option) -- 1.7.7.3