Skip Menu |

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

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

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

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



Subject: Getopt::Euclid dies at compile time
Date: Tue, 12 May 2009 13:46:45 -0400
To: bug-getopt-euclid [...] rt.cpan.org
From: Jordan Macdonald <macdjord [...] gmail.com>
Show quoted text
> > jordan@jordan-pc:~/sendNAV/mine$ perl -c sendNAVReports.plx > Uncaught exception from user code: > Invalid [] range "{-m" in regex; marked by <-- HERE in m/\A (?: \s* > (?:(??{exists$ARGV{q{-w[eek-ly]]}}?'(?!)':''}) > (?:-w(?:eek-ly)?])(?{($ARGV{q{-w[eek-ly]]}}||=[{}])->[-1]{q{}} = 1}) > (?:(?<!\w)|(?!\w)) (?{$ARGV{q{-w[eek-ly]]}} ||= [{}] > })|(??{exists$ARGV{q{-t[ag] [=|:] <report_type>}}?'(?!)':''}) (?:-t(?:ag)? > [\s\0\1]*(?:=|:)? [\s\0\1]*(?:(\S+)(?{($ARGV{q{-t[ag] [=|:] > <report_type>}}||=[{}])->[-1]{q{report_type}} = $^N}))) (?:(?<!\w)|(?!\w)) > (?{$ARGV{q{-t[ag] [=|:] <report_type>}} ||= [{}] })|(??{exists$A at > /usr/local/share/perl/5.8.8/Getopt/Euclid.pm line 513, <$fh> line 1. > BEGIN failed--compilation aborted at sendNAVReports.plx line 18. > at sendNAVReports.plx line 18 >
Situation: Getopt::Euclid is the first use other than pragmas and constants. POD, with human-readable content stripped: Show quoted text
> __END__ > =pod > > =head1 NAME > > sendNAVReports.plx > > =head1 VERSION > > sendNAVReports V1.0 > > =head1 REQUIRED ARGUMENTS > > =over > > =item -s[tart] [=|:] <timestamp> > > BLAH BLAH BLAH > > =for Euclid: > timestamp.type: integer >= 0 > > =item -e[nd] [=|:] <timestamp> > > BLAH BLAH BLAH > > =for Euclid: > timestamp.type: integer >= 0 > > =item -f[ile] [=|:] <customer_file> > > BLAH BLAH BLAH > > =for Euclid: > customer_file.type: readable > > =back > > =head1 OPTIONS > > BLAH BLAH BLAH > > =over > > =item -t[ag] [=|:] <report_type> > > BLAH BLAH BLAH > > =item -[no[t][-|_]]a[ll][email[s]] | -n > > BLAH BLAH BLAH > > =for Euclid: > false: -no[t][-|_]a[ll][email[s]] | -n > > =item -m[onth[ly] > > BLAH BLAH BLAH > > =item -w[eek-ly]] > > BLAH BLAH BLAH > > =back > > =head1 COPYRIGHT > > BLAH BLAH BLAH > > =cut >
Also, on an unrelated note: The CPAN documentation for Getopt::Euclid states that "Getopt::Euclid doesn't export anything.<http://search.cpan.org/%7Edconway/Getopt-Euclid-v0.2.0/lib/Getopt/Euclid.pm#Program_Interface>". Therefore, it would seem reasonable to assume that adding an explicit empty import list to the use statment should have no effect. This is not the case; given an empty import list Getopt::Euclid will fail silently. -- So many books, so little time... - Anon.
The bug is in your code. Show quoted text
> =item -m[onth[ly] > =item -w[eek-ly]]
Should be: Show quoted text
> =item -m[onth[ly]] > =item -w[eek[ly]]
Removed offending Getopt::Euclid doesn't export anything line from POD. You may get latest version from SVN if you like (https://getopt-euclid.svn.sourceforge.net/svnroot/getopt-euclid/trunk).
Fixed pod. Bug was in submitter's code.
Subject: Re: [rt.cpan.org #46001] Getopt::Euclid dies at compile time
Date: Wed, 13 May 2009 06:34:14 +1000
To: bug-Getopt-Euclid [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
2009/5/13 Kevin Galinsky via RT <bug-Getopt-Euclid@rt.cpan.org>: Show quoted text
> Queue: Getopt-Euclid > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=46001 > > > Fixed pod. Bug was in submitter's code. >
Thanks, Kevin. Both good. Of course, the error wrt the empty export list may still occur...because (as I'm sure you know) it's actually a feature of Perl. There are several places where an empty argument list is not the same as no argument list, and after a 'use' is one of them. Specifically: use Getopt::Euclid; # load module and call its &import with no arguments vs: use Getopt::Euclid (); # load module and don't call its &import at all There's nothing a module can do to overcome this difference, except to not rely on an &import at all. Perhaps your Pod update could specifically note that trap? Damian
Show quoted text
> There are several places where an empty argument list is not the same > as no argument list, and after a 'use' is one of them. Specifically: > > use Getopt::Euclid; # load module and call its &import with no > arguments > > vs: > > use Getopt::Euclid (); # load module and don't call its &import at > all > > There's nothing a module can do to overcome this difference, except to > not rely on an &import at all. > > Perhaps your Pod update could specifically note that trap?
Thanks for pointing that out - I misread the ticket. I actually view that as a feature that I hope to be expanding soon. I'll add to the documentation that Euclid relies on import to be run, and that you can actually suppress it from running right away by calling it with the empty argument list. The way I currently use it is by having several modules use Getopt::Euclid, each one's POD pushed onto the array to be parsed by Getopt::Euclid and the calling script using the modules with an empty argument list to prevent the command line arguments from being parsed until all the PODs are loaded.
I have updated the documentation.