* Bicknell, Frank ([EMAIL PROTECTED]) [21 Jul 2001 08:12]:

[...]
> Using Getopt::Long, it's possible to watch for negated options:
> -nostuff ... and it's possible to alias options "stuff|such" allows
> -stuff to be the same as -such.
[...]

> $ stuff -nosuch 
> Using Perl Version 5.00404
> Unknown option: nosuch
> Use of uninitialized value at stuff line 6.
> Stuff: <>
> $ 

> Anyone seen this before?

(a) You really should be using --nosuch rather than -nosuch.
Getopt::Long is just being smart and noting that there aren't any short
opts. 

(b) It works fine with perl 5.6 and Getopt::Long 2.25 (do the following
to determine what version you have:)

    perl -MGetopt::Long -l -e'print $Getopt::Long::VERSION'

(c) You are doing the right thing.

Doing some research yields:

                <http://search.cpan.org/doc/JV/Getopt-Long-2.25/CHANGES>

# Changes in version 2.22
# -----------------------
# 
# * Fixes a bug in the combination of aliases and negation.
# 
#   Old:  "foo|bar!" allowed negation on foo, but not on bar.
#   New:  "foo|bar!" allows negation on foo and bar.
# 
#   Caveat: "foo|f!", with bundling, issues the warning that negation on
#   a short option is ignored. To obtain the desired behaviour, use
# 
#         "foo!" => \$opt_foo, "f" => \$opt_foo
#   or
#         "foo|f" => \$opt_foo, "nofoo" => sub { $opt_foo = 0 }
# 
#   Remember that this is _only_ required when bundling is in effect.


So it was a bug, and is now fixed. You may want to upgrade your Perl
(the newer Getopt::Long is standard in 5.6.1) or just your Getopt::Long
(using CPAN; 2.24 seems to only need Perl 5.4 or later).

So, all you need is version 2.22 or later (current 2.25).


cheers,
-- 
iain.                                          <http://eh.org/~koschei/>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to