| Module Info
| Add a review of Getopt-Long
Thanks for this, this makes options handling a magically & flexible way !
Having worked for quite some time with option processing and several other similar modules, I have to say that most of the time you probably want to use Getopt::Long instead of the other alternatives. Or at least pick the alternatives which are based on Getopt::Long, instead of those that reinvent the wheel and do their own option parsing.
Most other modules that reinvent option parsing either don't bother to do short option bundling (-abc instead of -a -b -c), or abbreviation (--long-o instead --long-option-name), or the choice to (dis)allow mix-mashing options and arguments, or support '--' to end option processing, or respect ordering, or support multiple options (--verbose --verbose), or support '--foo=val' *as well as* '--foo val', and so on. These are features and conveniences that are taken for granted by people working daily in Unix command-line.
Trusted go-to module. ++ Huzzah!
Excellent module, although I use it through Getopt::Long::Descriptive, which makes a very useful complement for building applications.
There are a lot of competitors out there in the Getopt::* namespace, but none I've looked at actually seem like they're worth the trouble.
Getopt::Long does around 90% of what you really need, though in my opinion the default behavior is a little unfortunate: don't ignore the "bundling" and "no_ignore_case" options. If you want some clues about The Right Way to do use Getopt::Long, take a look at Andy Lester's App::Ack... he's already thought about this harder than you and I have.
Getting command line options and dealing with them is a colossal pain, and every module that does it sucks and offends someone. Getopt::Long doesn't always do what I want, and doesn't always act how I expect, but it's much closer than anything else. Given the number of different desires and expectations out there, and the fact that so many people aren't much more offended than I am by Getotp::Long, it must be doing something right!
Getopt::Long has been in use in my programs for a long time now. It has been suitable for all the command line parsing I have ever had to do and worked with anything I could throw at it through various shells. It works well with Getopt::ArgvFile.
Unlike more complicated command-line parsing modules like Getopt::Declare, Getopt::Long has a rather intuitive interface and doesn't require 1500 lines of documentation (as Damian put it).
I also tried some of the simpler wrappers around this module like Getopt::Simple, but while they worked fine for what they *could* do, I needed the power of Getopt::Long and actually find its interface good enough that it doesn't need simplifying wrappers.
This makes accepting command-line arguments powerful, flexible, and easy.
Getopt-Long adds a polished feel to a command line program. It supports all the typical Unixy conventions for flags and arguments. Combined with the Pod::Usage module from the PodParser distribution, it makes for a complete, self-documenting framework for an application.