in reply to Design of a global-variable storage package

Obviously, a program has but one @ARGV.
Thus, the data will be global.
sub func { local @ARGV = @_; my( @foo, @bar ); GetOptions( 'foo=s' => \@foo, 'bar=s' => \@bar, ); print "foo = @foo\nbar = @bar\n"; } func( -foo => 1, -bar => 1, -foo => 2, -bar => 2 );

:-)

We're building the house of the future together.

Replies are listed 'Best First'.
Re^2: Design of a global-variable storage package
by Tanktalus (Canon) on Nov 23, 2005 at 17:44 UTC

    You mostly have a point. Getopt::Long is simple enough for that scenario where everything pretty much lives inside a single function. This framework is targetted at more complex interaction where acceptable options come from multiple locations.

    I can imagine that some functions may find this useful, but I am having a hard time imagining what functions those may be ;-)