develooper Front page | perl.perl5.porters | Postings from March 2001

[ID 20010307.006] Getopt::Long config parameter getopt_compatdoesn't do what it should

Thread Next
From:
liff
Date:
March 7, 2001 15:16
Subject:
[ID 20010307.006] Getopt::Long config parameter getopt_compatdoesn't do what it should
Message ID:
20010308011553.A14513@puska.keltti.jyu.fi
This is a bug report for perl from liff@iki.fi,
generated with the help of perlbug 1.28 running under perl v5.6.0.


-----------------------------------------------------------------
[Please enter your report here]

It seems that the Getopt::Long configuration parameter, "getopt_compat"
which should affect the way options starting with the character '+'
doesn't actually make it ignore +something command line arguments.

Here's some code to demonstrate what I'm talking about:

---- snip ----
use Getopt::Long;

Getopt::Long::Configure("no_getopt_compat");

my $please_foo;

GetOptions('foo' => \$please_foo);

print "foo = ${please_foo}\n";
---- snip ----


And the result:

(liff@emi)~> perl getopt-test.pl +foo
foo = 1

Setting the POSIXLY_CORRECT environment variable does result in correct
behaviour though:

(liff@emi)~> POSIXLY_CORRECT=whynot perl getopt-test.pl +foo
foo =


I did look into Long.pm too and it seems that setting no_getopt_compat
doesn't change the option prefix variable from (--|-|\\+) to (--|-) like
I believe it should. However, simply setting prefix to (--|-) whenever the
value of getopt_compat changes doesn't seem very polite either since the
prefix is also configurable.

So, perhaps adding something like this below line 821 in Long.pm would fix
the problem(?):
  $genprefix = "(--|-)" if ( !$getopt_compat && $genprefix eq "(--|-|\\+)" );


Hope this helps..


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=low
---
Site configuration information for perl v5.6.0:

Configured by bod at Tue Feb 27 03:27:16 EST 2001.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.18, archname=i386-linux
    uname='linux duende 2.2.18 #1 thu dec 28 14:51:40 est 2000 i686 unknown '
    config_args='-Dccflags=-DDEBIAN -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.6.0 -Darchlib=/usr/lib/perl/5.6.0 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.6.0 -Dsitearch=/usr/local/lib/perl/5.6.0 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3 -Dpager=/usr/bin/pager -Uafs -Ud_csh -Uusesfio -Duseshrplib -Dlibperl=libperl.so.5.6.0 -Dd_dosuid -des'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=2.95.3 20010219 (prerelease)
    cppflags='-DDEBIAN -fno-strict-aliasing -I/usr/local/include'
    ccflags ='-DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lc -lcrypt
    libc=/lib/libc-2.2.2.so, so=so, useshrplib=true, libperl=libperl.so.5.6.0
  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.0:
    /usr/local/lib/perl/5.6.0
    /usr/local/share/perl/5.6.0
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.6.0
    /usr/share/perl/5.6.0
    /usr/lib/perl5/5.6/i386-linux
    /usr/lib/perl5/5.6
    /usr/lib/perl5/5.005/i386-linux
    .

---
Environment for perl v5.6.0:
    HOME=/home/liff
    LANG=finnish
    LANGUAGE (unset)
    LC_COLLATE=finnish
    LC_CTYPE=finnish
    LC_MESSAGES=C
    LC_MONETARY=finnish
    LC_NUMERIC=C
    LC_TIME=C
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/sbin:/usr/sbin:/usr/local/sbin:/home/liff/bin:/usr/local/j2sdk1.3.0/bin:.
    PERL_BADLANG (unset)
    SHELL=/bin/bash




Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About