CC: | "mytram2 [...] gmail.com" <mytram2 [...] gmail.com>, Adam Pfeiffer <apfeiffe [...] Brocade.com> |
Subject: | Small change to Getopt::ArgParse::_croak |
Date: | Tue, 3 Mar 2015 16:50:55 +0000 |
To: | "bug-Getopt-ArgParse [...] rt.cpan.org" <bug-Getopt-ArgParse [...] rt.cpan.org> |
From: | Adam Pfeiffer <apfeiffe [...] Brocade.com> |
Hello,
I would like to request one small enhancement to Getopt::ArgParse::_croak. Currently, when using an argument like this:
$ap->add_arg('--load_type', choices_i => [ '-sf', 'hcl' ], default => 'hcl', help => '-sf = single user, hcl = hotcodeload');
And the user specifies an invalid choice it dies with this error:
Getopt::ArgParse: Option load_type value blah not in choices: [ -sf, hcl ] (case insensitive) at /usr/local/share/perl/5.14.2/Getopt/ArgParse/Parser.pm line 56.
I believe it would be better if it didn't print this part of the statement:
at /usr/local/share/perl/5.14.2/Getopt/ArgParse/Parser.pm line 56.
My suggestion is to change line 58 from this:
die join('', @_ );
to this:
die join('', @_, "\n");
By adding the newline, you disable printing "at /usr/local/share/perl/5.14.2/Getopt/ArgParse/Parser.pm line 56." And the die message is more user friendly:
Getopt::ArgParse: Option load_type value blah not in choices: [ -sf, hcl ] (case insensitive)
P.S. I really like this module! I was using Getopt::Long and Getopt::Long::Descriptive and I find this to be much easier to use with better functionality! Thanks for providing this to the community.
Thanks much
Adam Pfeiffer
SQA Team
Brocade
4 Brocade Parkway, Broomfield, CO 80021
(720) 558-3681
www.brocade.com<http://www.brocade.com/>
[Brocade Logo]