Subject: | Getopt::Long package var 'pass_through' |
Hi Ricardo,
thanks a lot for App::Cmd and the rest of your wonderful modules,
especially Sub::Exporter!
I tried your App::Cmd framework for a CLI used with
Net::SNMP::Mixin.
I found the following nasty problem:
During global option processing the Getopt::Long config parameter
'pass_through' is set, in order to leave the rest of the @ARGV intact.
But successive command option processing is still tangled by these
Getopt::Long package variable and wrong command options are not
detected.
That's a problem, because this isn't described and is against the
default behavior of Getopt::Long. There should be a reset of this
Getopt::Long package variable(s) to default behavior.
I think, this should best be done in
App::Cmd::ArgProcessor::__process_args.
See my attached patch.
Best regards
Charly
Subject: | ArgProcessor.pm.patch |
--- lib/App/Cmd/ArgProcessor.pm 2008-03-20 02:59:21.000000000 +0100
+++ /tmp/ArgProcessor.pm 2008-04-29 10:18:04.000000000 +0200
@@ -23,6 +23,10 @@
my ($opt, $usage) = Getopt::Long::Descriptive::describe_options(@params);
+ # patch by charly -- 29.4.2008
+ # reset Getopt::Long to default behavior for successive calls
+ Getopt::Long::Configure('default');
+
return (
$opt,
[ @ARGV ], # whatever remained