Skip Menu |
 

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

Report information
The Basics
Id: 59509
Status: open
Priority: 0/
Queue: MooseX-Getopt

People
Owner: ether [...] cpan.org
Requestors: avar [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.30
  • 0.31
Fixed in: (no value)



Subject: s/help/help_flag/ in 0.30 broke existing MooseX::Getopt programs
Download (untitled) / with headers
text/plain 908b
The help attribute was renamed in 0.30 (81b19ed83c) so that any program that used MooseX::Getopt with a custom help switch is now returning empty output. E.g. this program: package Xailo; use 5.012; use Moose; with 'MooseX::Getopt'; has $ENV{help} => ( traits => [ qw/ Getopt / ], isa => 'Bool', is => 'ro', default => 0, documentation => "You're soaking it in", ); package xailo; Xailo->new_with_options; This worked before: $ help=help perl xailo --help You now have to do: $ help=help_flag perl xailo --help usage: xailo [long options...] --help_flag You're soaking it in In addition, you have to specify cmd_flag now so it's called --help, not --help_flag. Would it be possible to rename or alias the help attribute for backwards compatibility?
Download (untitled) / with headers
text/plain 1.7k
It doesn't look like the name of the attribute to hold the help information was previously documented as being public. To change it now, after it *has* been documented, would break other programs that conform to the published API. Adding an alias doesn't change the name of the attribute itself, only modify which methods can be used to interact with it, so adding a 'help' alias won't change the behaviour that you see. commit 81b19ed83c9e345f960ccefbcd639dd0e3c2de06 ... diff --git a/lib/MooseX/Getopt.pm b/lib/MooseX/Getopt.pm index 49b47b9..fdd4263 100644 --- a/lib/MooseX/Getopt.pm +++ b/lib/MooseX/Getopt.pm @@ -196,7 +196,8 @@ C<new_with_options> will throw an exception. If L<Getopt::Long::Descriptive> is installed and any of the following command line params are passed, the program will exit with usage -information. You can add descriptions for each option by including a +information (and the option's state will be stored in the help_flag +attribute). You can add descriptions for each option by including a B<documentation> option for each attribute to document. Your code should be written as: package Xailo; use Moose; use MooseX::Aliases; with 'MooseX::Getopt' => { -version => 0.30 }; has help_flag => ( traits => [ qw/ Getopt / ], isa => 'Bool', is => 'ro', alias => $ENV{help}, cmd_flag => $ENV{help}, cmd_aliases => [ qw(usage ?) ], documentation => "You're soaking it in", ); This should continue to work going forward, as the name of the attribute is documented. I was pondering the idea of adding an option to MooseX::Getopt::GLD to customize the name(s) of the help options, so you don't need to do any of this -- would this be of interest?


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

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.