2012/9/28 jvromans@squirrel.nl via RT <bug-Getopt-Long@rt.cpan.org>:
Show quoted text> <URL:
https://rt.cpan.org/Ticket/Display.html?id=79912 >
>
> [Quoting Jens Rehsack via RT, on September 28 2012, 13:17, in "Re: [rt.cpan.org #79"]
>> I'm sorry blaming Getopt::Long - but removing usage of GLD from test
>> program restores expected behaviour. OTOH I couldn't find something in
>> GLD which explains the premature exit (via HelpMessage()).
>
> While, in fact, GLD is -- unknowingly -- the reason that it fails.
>
> GLD does:
>
> use Getopt::Long 2.33 ();
>
> The above 'use' registers that GL version 2.33 was required.
> Subsequence use of GetOptions will use this knowledge to enable the
> autohelp facility.
Well, it shouldn't be possible for a module to override program settings
undesignedly. There is probably more than one way to reach that, but I
hope you find a way suitable for Getopt::Long. Probably once initialized
config doesn't become overwritten but extended/modified? Like attributes
in Moose which have 2 information: is_set/is_clear and their value - even
if the value is undefined ...
Is there anything which can be recommended to Ricardo to prevent that
behaviour in
Getopt::Long when GLD is initialized?
Show quoted text> As a consequence, in the test program:
>
> local @ARGV = qw(--help); # simulate behavior of MooseX::App::Cmd::Command
> my $parser2 = Getopt::Long::Parser->new( config => ['pass_through'] );
> $parser2->getoptions( 'configfile=s' => \$configfile );
>
> Since @ARGV is --help, GL calls its HelpMessage function. This calls
> pod2usage which prints nothing (there's no documentation) and exits.
>
> The best solution is to explicitly disable autohelp in the parser setup:
>
> my $parser2 = Getopt::Long::Parser->new( config => ['pass_through','no_auto_help'] );
>
> Does this help?
You recommend the same this I extended in my bug-report to MooseX::App::Cmd (see
https://github.com/mjgardner/moosex-app-cmd/issues). Hope that Mark
reacts quickly.
For the moment, I've added a patch to my local pkgsrc checkout, where
all my used
modules are installed from ...
... one "tiny" issue and finally work packages for 4 people - nice example how
good CPAN authors collaborate.
Thanks Johan.
Best regards,
Jens