Skip Menu |

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

Report information
The Basics
Id: 71165
Status: resolved
Priority: 0/
Queue: Getopt-Euclid

People
Owner: Nobody in particular
Requestors: blevering [...] ctgusa.com
Cc:
AdminCc:

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



Subject: Undeclared @arg variable
Date: Thu, 22 Sep 2011 13:44:57 -0400
To: <bug-Getopt-Euclid [...] rt.cpan.org>
From: Bill Levering <blevering [...] ctgusa.com>
My script has: Show quoted text
> use Getopt::Euclid qw(:vars<arg_>); >
I am using version 0.3.0. I also had the problem with 0.2.7. For optional arguments that are repeatable, I have two examples: 1. For =item --final-phase <name>, @arg_final_phase is declared, and is empty, when it is NOT present on the command line. Here we have an example of an empty list of scalar values. 2. For =item --final-keyword <keyword>:<value>, @arg_final_keyword is NOT declared, yet it should be an empty list of hash references. To test for its presence, I cannot simply say Show quoted text
>> if (@arg_final_keyword)
> I have to say
>> if (exists($main::{arg_final_keyword}))
> Seems odd. >
And, yes, both items have the line ³repeatable² in their =for Euclid: sections. Could all arguments be declared, whether or not their values are defined, or their arrays or hashes are empty? ŒTwould be so nice. Thank you, Bill Levering
Hi Bill, Thank you for reporting this issue. Options with multiple placeholders are exported as hashes (e.g. --size <h>x<w> is exported as %arg_size), but repeatable options are exported as arrays (e.g. a repeatable --final-phase <name> is exported as @arg_final_phase). Now, repeatable options with multiple placeholders (e.g. a repeatable --final-keyword <keyword>:<value>) have to be exported as arrays (e.g. @arg_final_keyword) as indicated in the documentation. It turns out that Getopt::Euclid was exporting repeatable --final-keyword <keyword>:<value> as a hash, instead of as an array. This issue is now fixed in the development branch of Getopt::Euclid. Expect a new package release very soon. Best, Florent