Skip Menu |

This queue is for tickets about the MooseX-Getopt CPAN distribution.

Report information
The Basics
Id: 52318
Status: resolved
Priority: 0/
Queue: MooseX-Getopt

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: MooseX::Getopt::Strict doesn't work with traits
This is a feature request. MooseX::Getopt::Strict doesn't appear to work if you use the traits feature. # MyApp.pm package MyApp; use Moose; with 'MooseX::Getopt::Strict'; has 'want_events' => ( # traits => [ 'Getopt' ], isa => 'Bool', is => 'ro', default => 0, cmd_flag => 'events', metaclass => 'Getopt', ); # myapp.pl --noevents use MyApp; my $app = MyApp->new_with_options(); # call as "myapp.pl --noevents" gives error "unknown option (noevents)" I'd write a patch, but I don't know Class::MOP well enough. If you point me in the right direction I'll be happy to read and try my hand at a patch.
On Tue Dec 01 07:42:39 2009, drew@drewtaylor.com wrote: Show quoted text
> I'd write a patch, but I don't know Class::MOP well enough. If you point > me in the right direction I'll be happy to read and try my hand at a
patch. This shouldn't matter, at least for writing some tests for this issue.. Try something like this: use Test::More; use Test::Exception; use My::Module; { my $i; local @ARGV = ('--option_you_want'); lives_ok { $i = My::Module->new_with_options }, '--option_you_want lives ok'; ok $i, 'Got instance with --option_you_want'; ok $i->option_you_want; } done_testing; If you could write some tests like that and attach them to this ticket, or commit them to a git repository (either the shadowcat git, or github or wherever) then that'd be really helpful. Thanks in advance. t0m