Subject: | Required attributes are demanded when usage requested |
Date: | Thu, 1 Dec 2016 12:00:13 -0500 |
To: | bug-MooseX-Getopt [...] rt.cpan.org |
From: | Patrick Cronin <pcronin [...] maxmind.com> |
Hello,
I love MooseX-Getopt, and thanks for making and maintaining it! However, I think I’ve found a small bug.
Using: perl 5, version 18, subversion 2 (v5.18.2) built for darwin-thread-multi-2level
Distribution: ETHER/MooseX-Getopt-0.71 (and also 0.59)
OS: Darwin gwana 15.6.0 Darwin Kernel Version 15.6.0: Thu Sep 1 15:01:16 PDT 2016; root:xnu-3248.60.11~2/RELEASE_X86_64 x86_64
With the following simple program in `test.pl`:
--------
#!/usr/bin/perl
package A;
use Moose;
with 'MooseX::Getopt';
has an_option => (
is => 'ro',
isa => 'Str',
required => 1,
);
__PACKAGE__->meta->make_immutable;
1;
package main;
use strict;
use warnings;
use A;
A->new_with_options()->run;
--------
I’d expect to be able to run:
$ ./test.pl -h
And see only usage. Instead, it first emits an error demanding the “an_option” parameter, and then it displays the usage.
--------
$ ./test.pl --help
Mandatory parameter 'an_option' missing in call to (eval)
usage: test.pl [-?h] [long options...]
-h -? --usage --help Prints this usage information.
--an_option
--------
Thanks,
-Patrick