Front page | perl.perl5.porters |
Postings from September 1999
[ID 19990930.014] getops() Problems
Thread Next
From:
brent
Date:
September 30, 1999 22:25
Subject:
[ID 19990930.014] getops() Problems
Message ID:
199910010526.AAA06211@marooned.tamu.edu
This is a bug report for perl from brent@marooned.tamu.edu,
generated with the help of perlbug 1.17 running under perl 5.00401.
To: perlbug@perl.com
Subject: getopts() returns a 1 when no opts are given
Reply-To: brent@marooned.tamu.edu
This is a bug report for perl from brent@marooned.tamu.edu,
generated with the help of perlbug 1.17 running under perl 5.00401.
-----------------------------------------------------------------
[Please enter your report here]
If I use:
$ret = getopts('hf:d:m:');
then
if (!$ret || $opt_h){
&PrintUsage;
exit(1);
}
$ret has the value of "1" even when no args are entered.
I do not understand why this is so. Can functionality be added
that will make getopts() return 0 if no args are passed?
The manpage also could use some work.
perldoc Getopt::Std
It appears to me that:
getopt('oDI'); # -o, -D & -I take arg.
appears to be incorrect...I understood that : signified if it took an arg or not.
Also, can I ask that the manpage explain the return codes?
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Site configuration information for perl 5.00401:
Configured by root at Thu Sep 11 18:55:58 CDT 1997.
Summary of my perl5 (5.0 patchlevel 4 subversion 1) configuration:
Platform:
osname=linux, osvers=2.0.27, archname=i686-linux
uname='linux marooned 2.0.27 #6 thu apr 10 10:45:30 cdt 1997 i686 '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=n useperlio=define d_sfio=
Compiler:
cc='gcc', optimize='-O2', gccversion=2.7.2.1
cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
stdchar='char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=4, usemymalloc=n, randbits=31
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /shlib /lib /usr/lib
libs=-lgdbm -ldbm -ldb -ldl -lm -lc
libc=/lib/libc.so.5.4.17, so=so
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
---
@INC for perl 5.00401:
/usr/lib/perl5/i686-linux/5.00401
/usr/lib/perl5
/usr/lib/perl5/site_perl/i686-linux
/usr/lib/perl5/site_perl
.
---
Environment for perl 5.00401:
HOME=/home/brent
LANG (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/brent:/home/brent/bin:.:/home/brent/bin:/sbin:/usr/sbin:/usr/ucb:/bin:/usr/bin:/usr/etc:/usr/bin/X11:/usr/games:/usr/local/bin:.
PERL_BADLANG (unset)
SHELL=/bin/zsh
---
Site configuration information for perl 5.00401:
Configured by root at Thu Sep 11 18:55:58 CDT 1997.
Summary of my perl5 (5.0 patchlevel 4 subversion 1) configuration:
Platform:
osname=linux, osvers=2.0.27, archname=i686-linux
uname='linux marooned 2.0.27 #6 thu apr 10 10:45:30 cdt 1997 i686 '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=n useperlio=define d_sfio=
Compiler:
cc='gcc', optimize='-O2', gccversion=2.7.2.1
cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
stdchar='char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=4, usemymalloc=n, randbits=31
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /shlib /lib /usr/lib
libs=-lgdbm -ldbm -ldb -ldl -lm -lc
libc=/lib/libc.so.5.4.17, so=so
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
---
@INC for perl 5.00401:
/usr/lib/perl5/i686-linux/5.00401
/usr/lib/perl5
/usr/lib/perl5/site_perl/i686-linux
/usr/lib/perl5/site_perl
.
---
Environment for perl 5.00401:
HOME=/home/brent
LANG (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/brent:/home/brent/bin:.:/home/brent/bin:/sbin:/usr/sbin:/usr/ucb:/bin:/usr/bin:/usr/etc:/usr/bin/X11:/usr/games:/usr/local/bin:.
PERL_BADLANG (unset)
SHELL=/bin/zsh
Thread Next
-
[ID 19990930.014] getops() Problems
by brent