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.



This archive was generated by hypermail 2.1.3 : Sun Nov 24 2002 - 10:50:48 GMT