develooper Front page | perl.perl5.porters | Postings from December 2003

CPAN Upload: J/JV/JV/Getopt-Long-2.34_01.tar.gz

Thread Next
From:
Johan Vromans
Date:
December 31, 2003 16:46
Subject:
CPAN Upload: J/JV/JV/Getopt-Long-2.34_01.tar.gz
Message ID:
16371.28143.101386.463546@phoenix.squirrel.nl
Happy New Year!

Getopt::Long 2.34_01 introduces experimental support for a feature
often asked: options with more than one value. For example

   --libs *.c *.h --geometry 2000 1024 --rgbcolor 255 255 149 

Options can be specified to have a minimum and maximum (or unlimited)
number of arguments, using a similar syntax as with regular expression
patterns. To parse the above command line, one can use

   GetOptions('libs=s{1,}' => \@libs,         # one or more
              'geometry=i{2}' => \@geo,       # exactly two
              'rgbcolor=i{3}' => \@colors);   # exactly three

Not surprisingly, 'foo=s{0,1}' is equivalent to 'foo:s{0,1}'. 

Have fun, and take care!

-- Johan

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