in reply to Getopt::Long to define or not to define?

The normal reason for setting a value (as opposed to leaving a parameter undefined) is to provide a sane default for the parameter. If you have no need for such a default, by all means leave the value undefined - caveat that you will have to explicitly test for this later, of course.
  • Comment on Re: Getopt::Long to define or not to define?

Replies are listed 'Best First'.
Re^2: Getopt::Long to define or not to define?
by jordanh (Chaplain) on Mar 04, 2005 at 21:52 UTC
    I've used this behavior to set defaults, but I've more often tested explicitly for undefined and set the default value in code.

    True, it's not as lazy as it could be, but it's more consistent for me because I tend to have a block of code that tests all the parameters for sanity, mutual exclusivity and the like right after the call to GetOptions().

    It's just my style, I guess.