Skip Menu |

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

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

People
Owner: kgalinsky [...] gmail.com
Requestors: kgalinsky [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.2.1
  • v0.2.0
Fixed in: v0.2.2



Subject: OPTIONS read as REQUIRED ARGUMENTS when a =cut is in between the sections
The attached file replicates the error. If your POD looks like: =head1 REQUIRED ARGUMENTS =over ... =back =cut =head1 OPTIONS ... Then your options are read as required arguments. This can easily be fixed in code using Getopt::Euclid by putting something between =cut and =head1 OPTIONS, however, this is still a bug. Am looking into this.
Subject: cut_test_fail.pl
#!/usr/bin/env perl use strict; use warnings; BEGIN { @ARGV = qw( -a 1 ) } use Getopt::Euclid; =head1 REQUIRED ARGUMENTS =over =item -a <a> =back =cut =head1 OPTIONS =over =item -b <b> =back =cut
Option was in the way the beginning/end of POD blocks was matched; both matches would slurp the following two newlines. Changed regexes to use zero-width lookahead/behind so that the matching must still occur, but it doesn't break when splitting up the source into pod blocks.
Subject: euclid.49524.diff
diff --git a/lib/Getopt/Euclid.pm b/lib/Getopt/Euclid.pm index 6183a27..4673834 100644 --- a/lib/Getopt/Euclid.pm +++ b/lib/Getopt/Euclid.pm @@ -147,8 +147,8 @@ sub import { # Set up parsing rules... my $HWS = qr{ [^\S\n]* }xms; my $EOHEAD = qr{ (?= ^=head1 | \z) }xms; - my $POD_CMD = qr{ (?! \n\n ) = [^\W\d]\w+ [^\n]* (?= \n\n )}xms; - my $POD_CUT = qr{ (?! \n\n ) = cut $HWS (?= \n\n )}xms; + my $POD_CMD = qr{ \n\n = [^\W\d]\w+ [^\n]* \n\n}xms; + my $POD_CUT = qr{ \n\n = cut $HWS \n\n}xms; my $NAME = qr{ $HWS NAME $HWS \n }xms; my $VERS = qr{ $HWS VERSION $HWS \n }xms; @@ -172,7 +172,7 @@ sub import { # Extract POD alone... my @chunks = $source =~ m{ $POD_CMD .*? (?: $POD_CUT | \z ) }gxms; - my $pod = join "\n\n", @chunks; + my $pod = join q{}, @chunks; # Extract essential interface components... my ($prog_name) = ( splitpath($0) )[-1];