Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^4: RFC Getopt::Hash

by radiantmatrix (Parson)
on Aug 09, 2005 at 18:15 UTC ( #482347=note: print w/replies, xml ) Need Help??

in reply to Re^3: RFC Getopt::Hash
in thread RFC Getopt::Hash

I believe it is already done: Getopt::Mixed. The syntax is slightly different from Getopt::Long, so it isn't a drop-in replacement. Also, by default, it exports a bunch of scalars into the calling package (bad, IMO) -- the non-default behavior is pretty nice, though:

use Getopt::Mixed 'nextOption'; Getopt::Mixed::init('option1=s>o', 'option2:i>o2'); my %opt = ( option1 => 'default1', option2 => 'default2', ); while ( my ($k, $v) = nextOption() ) { $opt{$k} = $v } Getopt::Mixed::cleanup(); ## what's left is now in @ARGV

Using nextOption lets you process serially, too, which can be nice sometimes.

Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P)
The Code that can be seen is not the true Code
"In any sufficiently large group of people, most are idiots" - Kaa's Law

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://482347]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2018-07-20 05:33 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (424 votes). Check out past polls.