Option in getopts to ignore case?
Option in getopts to ignore case?
am 16.11.2007 15:56:03 von Deane.Rothenmaier
This is a multipart message in MIME format.
--===============0596288741==
Content-Type: multipart/alternative;
boundary="=_alternative 0052098186257395_="
This is a multipart message in MIME format.
--=_alternative 0052098186257395_=
Content-Type: text/plain; charset="US-ASCII"
Gurus,
I found nothing in the perldoc for Getopt::Std that allows the getopts
function to ignore case in its arguments. Is there something hidden that
will make getopts insensitive to case? Or is there perhaps a case-ignoring
alternative to this function?
Thanks!
Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150
A word to the wise ain't necessary, it's the stupid ones who need the
advice. -- Bill Cosby
--=_alternative 0052098186257395_=
Content-Type: text/html; charset="US-ASCII"
Gurus,
I found nothing in the perldoc for Getopt::Std
that allows the getopts function to ignore case in its arguments. Is there
something hidden that will make getopts insensitive to case? Or is there
perhaps a case-ignoring alternative to this function?
Thanks!
Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150
A word to the wise ain't necessary, it's the stupid ones who need the advice.
-- Bill Cosby
--=_alternative 0052098186257395_=--
--===============0596288741==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0596288741==--
RE: Option in getopts to ignore case?
am 16.11.2007 16:55:54 von HBullock
>>I found nothing in the perldoc for Getopt::Std that allows the getopts
function to ignore case in its arguments. Is there >>something hidden
that will make getopts insensitive to case? Or is there perhaps a
case-ignoring alternative to this function?
I have always used Getopt::Long.
Case and abbreviations
Without additional configuration, GetOptions() will ignore the case of
option names, and allow the options to be abbreviated to uniqueness.
GetOptions ('length|height=f' => \$length, "head" => \$head);
This call will allow --l and --L for the length option, but requires a
least --hea and --hei for the head and height options.
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Option in getopts to ignore case?
am 16.11.2007 17:10:16 von Sean Tobin
--===============0403072590==
Content-Type: multipart/alternative;
boundary="_693275a0-2df5-40c8-93b6-6d0f1c681131_"
--_693275a0-2df5-40c8-93b6-6d0f1c681131_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Getopt by itself will preserve case. If you want to force all your
options to lowercase, you can map @ARGV to lowercase. For example:
use Getopt::Std;use Data::Dump qw(dump);use strict;@ARGV=3Dmap(lc,@ARGV);my=
%options;getopt('odi',\%options);print dump \%options;exit;
This will map all your arguments AND parameters to lowercase. If this were =
executed such as:=20
perl optest.pl -o 1 -D 2 -i "FooBaR"{ d =3D> 2, i =3D> "foobar", o =3D> 1 }
Note specifically that "FooBaR" has also been made lowercase.=20
I
suggest taking a look at Getopt::Mixed, Getopt::Compact and
Getopt::Long. All of which support case-insensitive parameter matching
as an option.=20
Sean Tobin
byrdhuntr@hotmail.com
To: activeperl@listserv.ActiveState.com
Subject: Option in getopts to ignore case?
From: Deane.Rothenmaier@walgreens.com
Date: Fri, 16 Nov 2007 08:56:03 -0600
Gurus,
I found nothing in the perldoc for Getopt::Std
that allows the getopts function to ignore case in its arguments. Is there
something hidden that will make getopts insensitive to case? Or is there
perhaps a case-ignoring alternative to this function?
Thanks!
Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150
A word to the wise ain't necessary, it's the stupid ones who need the advic=
e.
-- Bill Cosby
____________________________________________________________ _____
Help yourself to FREE treats served up daily at the Messenger Caf=E9. Stop =
by today.
http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid =3DTXT_TAGLM_Oc=
tWLtagline=
--_693275a0-2df5-40c8-93b6-6d0f1c681131_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Getopt by itself will preserve case. If you want to force all your
options to lowercase, you can map @ARGV to lowercase. For example:
use Getopt:=
:Std;
style=3D"font-family: Courier New,Courier,Monospace;">use Data::Dump qw(du=
mp);
style=3D"font-family: Courier New,Courier,Monospace;">use strict;
style=3D"font-family: Courier New,Courier,Monospace;">
mily: Courier New,Courier,Monospace;">
ew,Courier,Monospace;">@ARGV=3Dmap(lc,@ARGV);
y: Courier New,Courier,Monospace;">
urier,Monospace;">
;">my %options;
ce;">getopt('od=
i',\%options);
e;">print dump =
\%options;
=
exit;
=
span>This will map all your arguments AND parameters to lowercase. If this =
were executed such as:
ace;">
perl =
optest.pl -o 1 -D 2 -i "FooBaR"
,Courier,Monospace;">
ace;">{ d =3D> 2, i =3D> "foobar", o =3D> 1 }
ont-family: Courier New,Courier,Monospace;">
Note specifically that "Foo=
BaR" has also been made lowercase.
I
suggest taking a look at Getopt::Mixed, Getopt::Compact and
Getopt::Long. All of which support case-insensitive parameter matching
as an option.
Sean Tobin
byrdhuntr@hotmail.com
quote>
To: activeperl@listserv.ActiveState.com
Subject: Option in get=
opts to ignore case?
From: Deane.Rothenmaier@walgreens.com
Date: Fri,=
16 Nov 2007 08:56:03 -0600
Gurus,
I found nothing in the perldoc for=
Getopt::Std
that allows the getopts function to ignore case in its arguments. Is there
something hidden that will make getopts insensitive to case? Or is there
perhaps a case-ignoring alternative to this function?
Thanks!
Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150
A word to the wise ain't necessary, it's the stupid ones who need the advic=
e.
-- Bill Cosby
Help yourself to FREE treats s=
erved up daily at the Messenger Caf=E9.
..com/info/info_sweetstuff2.html?ocid=3DTXT_TAGLM_OctWLtagli ne' target=3D'_n=
ew'>Stop by today!
=
--_693275a0-2df5-40c8-93b6-6d0f1c681131_--
--===============0403072590==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0403072590==--
RE: Option in getopts to ignore case?
am 16.11.2007 21:39:46 von Deane.Rothenmaier
This is a multipart message in MIME format.
--===============1991720120==
Content-Type: multipart/alternative;
boundary="=_alternative 0071819286257395_="
This is a multipart message in MIME format.
--=_alternative 0071819286257395_=
Content-Type: text/plain; charset="US-ASCII"
Problem's been solved. Thanks to all who responded: Howard, Josh P., and
Sean--whose quick easy solution did the trick.
Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150
A word to the wise ain't necessary, it's the stupid ones who need the
advice. -- Bill Cosby
--=_alternative 0071819286257395_=
Content-Type: text/html; charset="US-ASCII"
Problem's been solved. Thanks to all
who responded: Howard, Josh P., and Sean--whose quick easy solution did
the trick.
Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150
A word to the wise ain't necessary, it's the stupid ones who need the advice.
-- Bill Cosby
--=_alternative 0071819286257395_=--
--===============1991720120==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1991720120==--