Subject: | Configuration to be passed with call |
Getopt::Long provides several configuration options which can be set
with its Configure() routine. But this is awkward to use in a
library. I want to set some configuration options in my routine but
not have them affect any GetOptions calls that happen after my routine
finishes. While I could call Configure() again to set the options
back, I don't actually know what they were before.
It would be more usable for configuration options to be passed in
directly to the GetOptions call, perhaps by a hashref passed as the
first argument. Then
GetOptions({ pass_through => 1 }, 'foo' => \$foo);
would set the pass_through flag just for this call (but the current
configured settings otherwise). Where you want to ignore any prior
Configure() calls and use a known set of options, the existing
'default' option could be used:
GetOptions({ default => 1, pass_through => 1}, ...)
will set pass_through but use the default config otherwise. The
implementation will have to be a little bit careful since hash keys
are unordered, so it should look for 'default' first.