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

Report information
The Basics

kgalinsky [...]
djerius [...]

Broken in:
Fixed in:
(no value)

Subject: /regex/ placeholder type doesn't accept all regexes correctly
I'd like to use the following regex for a placeholder type: =item -t <op> The string used to prefix the output file name(s). =for Euclid op.type: /^(add|mul)$/ op.default: 'mul' but the leading ^ seems to mess up the works. With only optional arguments, "-t add" results in: Invalid "-t <op>" argument <op> must be /^(add|mul)$/ but the supplied value ("add") isn't. If I add some required arguments, "-t add" results in: Unknown argument: add (Similar to bug #27074) Removing the ^ makes it "work". Sample code follows: #!/usr/bin/perl use strict; use warnings; use Getopt::Euclid qw( :minimal_keys ); __END__ =head1 REQUIRED ARGUMENTS =over =item <regfile> The name of the region file upon which to operate. =for Euclid regfile.type: readable =back =head1 OPTIONS =over =item -t <op> The string used to prefix the output file name(s). =for Euclid op.type: /^(add|mul)$/ op.default: 'mul' =bac
Hi DJERIUS, I had noticed this error, too. I am creating tests for these issues and will debug the problem from there. If you would like to contribute, please contact me. -Kevin
Here are places that need to be changed to fix this ticket: _convert_to_regex converts the relatively simple regex into a rather complicated one. Since I have just started looking into the code, I am not sure what all of it does. On line 381, the arguments get concatenated into a string and passed to _doesnt_match which verifies that the arguments look ok. The boundary constraints in a regular expression will mess up this step as well. In addition, it appears as though regex options must entirely match a string: use Getopt::Euclid =head1 OPTIONS =over =item [-]-o[ption] <o> =for Euclid: o.type: /\d/ =back =cut --- perl -o 1 # works perl -o a # fails (<o> must be /\d/ but the supplied value ("a") isn't) - ok perl -o a1 # fails (<o> must be /\d/ but the supplied value ("a1") isn't) - not expected perl -o 1a # fails (Unknown argument: -o 1a) - not expected perl -o 12 # fails (Unknown argument: -o 12) - not expected I would say this is incorrect (furthermore, the errors are inconsistent). To accept anything containing a number, you would have to construct the following regex /.*\d.*/, which looks uglier. I will have to put this ticket on hold while I look more at Getopt::Euclid.

This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with to