Skip Menu |

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

Report information
The Basics
Id: 114519
Status: rejected
Priority: 0/
Queue: Getopt-Long

People
Owner: jv [...] cpan.org
Requestors: Ben.Golding [...] synopsys.com
Cc:
AdminCc:

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



Subject: Documentation/examples correction for option with hash value
Date: Fri, 20 May 2016 13:01:50 +0000
To: "bug-Getopt-Long [...] rt.cpan.org" <bug-Getopt-Long [...] rt.cpan.org>
From: Ben Golding <Ben.Golding [...] synopsys.com>
I'm referring to the docs at http://perldoc.perl.org/Getopt/Long.html#Case-and-abbreviations 1) Section 'User-defined subroutines to handle options' "For a hash destination, the second argument is the key to the hash, and the third argument the value to be stored." It would help to explicitly mention that the option must have the '%' suffix to activate this behaviour with a user-defined subroutine. Perhaps you can also add a cross-reference to 'Summary of Option Specifications' where % is explained (and/or) to the example in 'Pushing multiple values in a hash option' 2) "... The value will be stored with the specified key in the hash. GetOptions ("define=s" => \%defines); Alternatively you can use: GetOptions ("define=s%" => \$defines); When used with command line options: --define os=linux --define vendor=redhat" the hash %defines (or %$defines ) will contain two keys, ..." This example needs a max value of 2 or more to work as described, e.g.: GetOptions ("define=s{1,}" => \%defines); GetOptions ("define=s%{1,}" => \$defines); Perhaps you can also add a cross-reference to 'Summary of Option Specifications' where min/max are explained. Thanks! Ben Golding
Show quoted text
> This example needs a max value of 2 or more to work as described,
I cannot reproduce this. It works as documented.