in reply to Using "with 'MooseX::Getopt::Usage' throwing error with MooseX::App::Cmd::Command
The following works for me:
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; { package My; use Moose; extends 'MooseX::App::Cmd::Command'; with qw{ MooseX::Getopt::Usage }; has test => ( traits => [qw[ Getopt ]], isa => 'Bool', is => 'rw', cmd_aliases => 't', documentation => 'test me', ); sub execute { my ($self, $opt, $args) = @_; say $self->test; } __PACKAGE__->meta->make_immutable; } my $app = 'My'->new_with_options;
When I call
script.pl --usage
I get the usage back. When, on the other hand, I try with
script.pl --test
It fails with
I have no idea where it's coming from, as the documentation of neither MooseX::App::Cmd::Command, MooseX::Getopt::Usage, MooseX::App::Cmd, nor App::Cmd mentions it.Required option missing: app
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using "with 'MooseX::Getopt::Usage' throwing error with MooseX::App::Cmd::Command
by nysus (Parson) on Feb 05, 2018 at 17:51 UTC |