home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / perl / 7731 < prev    next >
Encoding:
Text File  |  1993-01-09  |  1.5 KB  |  37 lines

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