32.27. Getopt::LongIf your program says: it can be called from the command line like this:use Getopt::Long; GetOptions("verbose" => \$verbose, "debug" => \$debug, "output=s" => \$output); The Getopt::Long module provides a GetOptions function to process command-line switches with long names. It includes support for things like abbreviating switches, typed arguments like Boolean or string or integer or float, array variables for repeating options, user-defined validation routines, POSIX-conforming versus FSF-style processing, case-insensitive options, and traditional bundling of short options--just to name a few out of its vast cornucopia of features. If this module is overkill, consider the more traditional Getopt::Std module described next. If this module is underkill, check out the CPAN module Getopt::Declare, which provides a more declarative syntax for option specification.% prog --verbose more args here % prog --debug more args here % prog -v -d more args here % prog --output=somefile more args here % prog -o somefile more args here Copyright © 2001 O'Reilly & Associates. All rights reserved. |
|