cmd line parsing emulating sv[kn]

Dave Cross dave at dave.org.uk
Thu Feb 2 10:24:10 GMT 2006


Paul Makepeace wrote:
> I have a script where I'd like to emulate svn's -r option. It goes like,
>   -r 1676
>   -r1676 (i.e. whitespace not significant)
>   -r168:200 (I can probably manage to parse out the two numbers...)
> 
> I've used Getopt::Long (since I know it) with GetOptions("r=s" => \$revs)
> but Go::L seems to require a space between switch & arg which is confusing
> for anyone using sv[kn].
> 
> Any suggestions which module to use?

If you're only ever going to have single letter options then GetOpt::Std 
seems to do all you want.

> Is there a Giant List of CPAN CLI Parsers and Their Features anywhere? 

You can get a rather scary looking list from

   http://search.cpan.org/search?query=getopt%3A%3Bstd&mode=module

I'm particularly worried by

   http://search.cpan.org/dist/Getopt-WonderBra/lib/Getopt/WonderBra.pm

:)

Dave...


-- 
Site: http://dave.org.uk/
Blog: http://blog.dave.org.uk/
Code: http://dave.org.uk/code/


More information about the london.pm mailing list