Skip Menu |

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

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

Owner: Nobody in particular
Requestors: ether [...]

Bug Information
Severity: Wishlist
Broken in: 0.29
Fixed in: 0.36

Subject: Feature suggestion: allow configuration of Getopt::Long
Download (untitled) / with headers
text/plain 1.3k
I went searching for a way to disable bailing out if an unrecognized error was passed, e.g: perl -MMyApp::Foo -wle'my $obj = MyApp::Foo->new_with_options' -- --unrecognized_option The feature in Getopt::Long that is relevant is "pass_through": I found that simply adding this at the top of my class definition (before applying MooseX::Getopt) works: use Getopt::Long qw(:config pass_through); However, that would override any other options and version checking that the MX modules are performing. There is an alternate way of configuring Getopt::Long: Getopt::Long::Configure(qw(pass_through)); ...which would need to be called in MooseX::Getopt::Basic new_with_options() before instantiating the GO:L:Parser object. My proposal is allowing these config options as role parameters to MooseX::Getopt, e.g.: with 'MooseX::Getopt' => { getopt_options => [ qw(pass_through) ] }; Alternatively, the class could provide a function which is invoked inside new_with_options, which calls Getopt::Long::Configure, although I don't think it's good a method: sub new_with_options { ... $class->_configure_hook if $class->can('_configure_hook'); my $opt_parser = Getopt::Long::Parser->new(...); ... }
Hey ether, Damien Krotkine did this last year in v0.36 - see commit 0611312e!

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to