Bug in -W (and other?) option parsing

From: Martyn J. Pearce <fluffy@inpharmatica.co.uk>
Date: Tue Dec 18 2001 - 17:19:52 GMT

In attempting to switch off clustering of files with like change messages, I
invoked

 perl ~/cvs2cl.pl -t -W 0

And was surprised to find

  "-W needs argument."

This is because the relevant bit of options parsing does

  my $narg = shift (@ARGV) || die "$arg needs argument.\n";

Where the || implicitly tests the truth of the value, in addition to its
definedness.

Replacing the above with

  defined(my $narg = shift (@ARGV)) || die "$arg needs argument.\n";

will fix this.

Is there a reason why cvs2cl.pl does not use the Getopt::Long module?

Mx.
Received on Thu May 23 08:33:01 2002

This archive was generated by hypermail 2.1.8 : Wed Jan 21 2004 - 16:25:32 GMT