home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!munnari.oz.au!metro!usage!spectrum!cameron
- From: cameron@spectrum.cs.unsw.oz.au (Cameron Simpson)
- Subject: Re: getopts.pl bug fix
- Message-ID: <1993Jan9.091207.2162@usage.csd.unsw.OZ.AU>
- Summary: they aren't bugs
- Sender: news@usage.csd.unsw.OZ.AU
- Nntp-Posting-Host: fuligin.spectrum.cs.unsw.oz.au
- Reply-To: cameron@spectrum.cs.unsw.oz.au (Cameron Simpson)
- Organization: CS&E Computing Facility, Uni Of NSW, Oz
- References: <1993Jan8.062100.20495@uvaarpa.Virginia.EDU>
- Date: Sat, 9 Jan 1993 09:12:07 GMT
- Lines: 22
-
- In article <1993Jan8.062100.20495@uvaarpa.Virginia.EDU> aks%anywhere@hub.ucsb.edu writes:
- | In debugging a new script, I've found a couple of bugs in "getopts.pl"
- | (typically installed as /usr/local/lib/perl/getopts.pl).
- |
- | First, if an option requires an argument and @ARGV is empty, its
- | variable will get set to "shift @ARGV", which is "undef"; not a good
- | thing to *set* a variable with.
-
- I disagree. It's an excellent way to indicate that no value was supplied,
- which is exactly the circumstance here.
-
- | Second, if you give two consecutive options, both of which want
- | arguments, the second option is used as the value for the first. Eg:
- | '-x -y' results in $opt_x eq '-y', not the expected result of setting
- | both $opt_x and $opt_y.
-
- But what if I _want_ to set to argument of -x to "-y"? With your patch I'm
- screwed. This is NOT a bug!
- - Cameron Simpson
- cameron@cse.unsw.edu.au, DoD 0743
- --
- If it can't be turned off, it's not a feature. - Karl Heuer
-