# New Ticket Created by [email protected: r...@raf.org]
# Please include the string: [perl #18814]
# in the subject line of all future correspondence about this issue.
# <URL:
http://rt.perl.org/rt2/Ticket/Display.html?id=18814 >
This is a bug report for perl from [email protected: r...@raf.org],
generated with the help of perlbug 1.33 running under perl v5.6.1.
-----------------------------------------------------------------
[Please enter your report here]
greetings,
perldoc Getopt::Long says (in Configuring Getopt::Long):
> gnu_getopt This is a short way of setting "gnu_compat"> "bundling" "permute" "no_getopt_compat". With> "gnu_getopt", command line handling should be> fully compatible with GNU getopt_long().but it also says (in Getting Started with Getopt::Long):
> This module also supports single-character options and bundling.> In this case, the options are restricted to alphabetic characters> only, and the characters "?" and "-".which means that it is not compatible with getopt_long() since getopt_long()
does not impose arbitrary restrictions on which characters may be used as
option letters. the only characters that can't be used are ':' and '?'
because they clash with error codes.
the only characters that i think should be disallowed by Getopt::Long are
|!+=: since, according to the doco (Summary of Option Specifications), these
characters terminate option names and aliases and have special meanings.
according to the code, ~ needs to be added to the list.
example:
> #!/usr/bin/perl -w> use strict;> use Getopt::Long;> my %opt;> GetOptions \%opt, qw(.|stop);> print "stop\n" if exists $opt{'.'};this code outputs:
> Error in option spec: ".|stop"it should do:
$ ./hmm -.
stop
i can't see how this can be considered an error.
here's a patch. i haven't done thorough testing on this patch.
and i don't know if it breaks anything. but it's a start.
--- Long.pm.orig Tue Apr 2 03:28:01 2002
+++ Long.pm Tue Dec 3 00:38:32 2002
@@ -308,8 +308,8 @@
next;
}
- # Match option spec. Allow '?' as an alias only.
- if ( $opt !~ /^((\w+[-\w]*)(\|(\?|\w[-\w]*)?)*)?([!~+]|[=:][infse][@%]?)?$/ ) {
+ # Match option spec.
+ if ( $opt !~ /^(([^-|!~+=:][^|!~+=:]*)(\|([^-|!~+=:][^|!~+=:]*)?)*)?([!~+]|[=:][infse][@%]?)?$/ ) {
$error .= "Error in option spec: \"$opt\"\n";
next;
}
@@ -1090,9 +1090,7 @@
Getopt::Long is the Perl5 successor of C<newgetopt.pl>. This was
the first Perl module that provided support for handling the new style
of command line options, hence the name Getopt::Long. This module
-also supports single-character options and bundling. In this case, the
-options are restricted to alphabetic characters only, and the
-characters C<?> and C<->.
+also supports single-character options and bundling.
To use Getopt::Long from a Perl program, you must include the
following line in your Perl program:
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=library
severity=low
---
Site configuration information for perl v5.6.1:
Configured by bhcompile at Mon Apr 1 12:22:19 EST 2002.
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
Platform:
osname=linux, osvers=2.4.17-0.13smp, archname=i386-linux
uname='linux daffy.perf.redhat.com 2.4.17-0.13smp #1 smp fri feb 1 10:30:48 est 2002 i686 unknown '
config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Uusethreads -Uuseithreads -Uuselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
Compiler:
cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include',
optimize='-O2 -march=i386 -mcpu=i686',
cppflags='-fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.2 2.96-109)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
---
@INC for perl v5.6.1:
/usr/lib/perl5/5.6.1/i386-linux
/usr/lib/perl5/5.6.1
/usr/lib/perl5/site_perl/5.6.1/i386-linux
/usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl/5.6.0/i386-linux
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.6.1/i386-linux
/usr/lib/perl5/vendor_perl/5.6.1
/usr/lib/perl5/vendor_perl
.
---
Environment for perl v5.6.1:
HOME=/home/raf
LANG=en_US.iso885915
LANGUAGE (unset)
LC_COLLATE=C
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/raf/bin:/home/raf/bin/site/eccles:/opt/acroread/bin:/opt/j2se/bin:/opt/jukebox/bin:/opt/majordomo/bin:/opt/office:/opt/quake:/opt/real:/opt/weblog:/usr/local/bin:/usr/X11R6/bin:/usr/kerberos/bin:/usr/bin:/bin:/usr/sbin:/sbin:.
PERL_BADLANG (unset)
SHELL=zsh