in reply to using "Getopt::Long" how to check parameter mandatory

How can i control this case using Getopt::Long.
As Johan Vromans (author of Getopt::Long) tends to say "mandatory arguments aren't options". Hence, there's no build-in functionality in Getopt::Long to enforce mandatory parameters.

But you can also die afterwards if certain parameters aren't defined.

  • Comment on Re: using "Getopt::Long" how to check parameter mandatory

Replies are listed 'Best First'.
Re^2: using "Getopt::Long" how to check parameter mandatory
by DrWhy (Chaplain) on Aug 24, 2010 at 21:39 UTC
    That's a very narrow view of 'command line options'. It is better I believe to think of them as named parameters, some of which may be required and some optional.

    --DrWhy

    "If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."

      Considering he's the author of the module, he may have an as narrow minded view as he wishes. He made his work available for others to use, if you don't like the module, you have the freedom to write your own, and then you can treat options to not be optional.