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

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

Thread Next
Johan Vromans
December 31, 2003 16:46
CPAN Upload: J/JV/JV/Getopt-Long-2.34_01.tar.gz
Message ID:
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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About