in reply to why this not work?
Your description but that not work it is not so useful to me to understand what you want to achieve.
Constructs like unless (A && B) are potentially confusing: your call to error_info happens only if GetOptions returns true and also $show_help is defined. It does not seems too logical to me.
After I read The Dynamic Duo --or-- Holy Getopt::Long, Pod::UsageMan! i usually start with something like:
use Getopt::Long; use Pod::Usage; unless ( GetOptions ( "color=s"=>\$par_color, "help" => \$par_help, ) ) {pod2usage(-verbose => 1)} if (defined $par_help){pod2usage(-verbose => 1)}
pod2usage implicitly exit the program. And is a sane behaviour: exit if arguments are not what you expected and exit if user requested help to be shown.
After this you need to manually validate your given arguments, but this is another story..
See also GetOpt Organization
HtH
L*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: why this not work? -- return value of GetOptions
by zapp_prefect (Initiate) on Oct 10, 2016 at 08:27 UTC | |
by Corion (Patriarch) on Oct 10, 2016 at 08:34 UTC | |
by zapp_prefect (Initiate) on Oct 10, 2016 at 09:08 UTC |