in reply to MooseX::Getopt help without nagging

Hi,

MooseX::GetOpt just translates options to following call to Getopt::Long::Descriptive

use Getopt::Long::Descriptive; my ($opt, $usage) = describe_options( 'usage: mxgotest.pl [-?] [long options...]', [ 'help|usage|?!' => 'Prints this usage information.' ], [ 'name=s' => 'Sets the name', { required => 1 } ], );

The message is caused by required parameter. From the GLD docs:

If an option is required, failure to provide the option will result in describe_options printing the usage message and exiting.

I would remove the required from the name attribute and implemented the functionality after new_with_options call.

-- Roman

Replies are listed 'Best First'.
Re^2: MooseX::Getopt help without nagging
by Boldra (Curate) on Aug 25, 2010 at 07:41 UTC
    Ok, then this looks to me like a bug in Getopt::Long::Descriptive . I want something that behaves more like standard unix utils like rm:

    If I type just rm, I get a message that I'm missing a parameter AND the usage information. If I type rm --help I get the help information and no complaints.

    In my simple example leaving required out might appear to be a solution, but in practice I might have four or six required arguments, and using moose features could save me about ten lines of code.





    - Boldra