I am using Getopt::Long
to parse options passed to my program. I would like to format these options (after modifying them) to pass to another program.
Does Getopt do this, or is there possibly another module that can do this for me?
Example:
use Getopt::Long qw(:config no_ignore_case );
# set defaults
my %ARG;
$ARG{config} = './default-config.ini';
$ARG{debug} = 0;
# process command line options
GetOptions( \%ARG, 'config|c=s', 'debug!');
# modify them as necessary
if ( if $ARG{debug} ) {
$ARG{config} = './debug-config.ini' ;
$ARG{debug} = 0;
$ARG{verbal} = 1;
}
# format options string to pass to other command
# expecting something like this in options string:
# '-config=./debug-config.ini --verbal'
$options_string = some_method_or_module_to_format( %ARG, 'config=s', 'verbal' );
`some-other-script-1.pl $options_string`;
`some-other-script-2.pl $options_string`;
`some-other-script-3.pl $options_string`;